@Bean
    public RetryRegistry retryRegistry(RetryConfigurationProperties retryConfigurationProperties,
        EventConsumerRegistry<RetryEvent> retryEventConsumerRegistry,
        RegistryEventConsumer<Retry> retryRegistryEventConsumer,
        @Qualifier("compositeRetryCustomizer") CompositeCustomizer<RetryConfigCustomizer> compositeRetryCustomizer) {
        RetryRegistry retryRegistry = createRetryRegistry(retryConfigurationProperties,
            retryRegistryEventConsumer, compositeRetryCustomizer);
        registerEventConsumer(retryRegistry, retryEventConsumerRegistry,
            retryConfigurationProperties);
        retryConfigurationProperties.getInstances()
            .forEach((name, properties) ->
                retryRegistry.retry(name, retryConfigurationProperties
                    .createRetryConfig(name, compositeRetryCustomizer)));
        return retryRegistry;
    }
@Test
    public void testCreateRetryRegistryWithSharedConfigs() {
        InstanceProperties defaultProperties = new InstanceProperties();
        defaultProperties.setMaxAttempts(3);
        defaultProperties.setWaitDuration(Duration.ofMillis(100L));
        InstanceProperties sharedProperties = new InstanceProperties();
        sharedProperties.setMaxAttempts(2);
        sharedProperties.setWaitDuration(Duration.ofMillis(100L));
        InstanceProperties backendWithDefaultConfig = new InstanceProperties();
        backendWithDefaultConfig.setBaseConfig("default");
        backendWithDefaultConfig.setWaitDuration(Duration.ofMillis(200L));
        InstanceProperties backendWithSharedConfig = new InstanceProperties();
        backendWithSharedConfig.setBaseConfig("sharedConfig");
        backendWithSharedConfig.setWaitDuration(Duration.ofMillis(300L));
        RetryConfigurationProperties retryConfigurationProperties = new RetryConfigurationProperties();
        retryConfigurationProperties.getConfigs().put("default", defaultProperties);
        retryConfigurationProperties.getConfigs().put("sharedConfig", sharedProperties);
        retryConfigurationProperties.getInstances()
            .put("backendWithDefaultConfig", backendWithDefaultConfig);
        retryConfigurationProperties.getInstances()
            .put("backendWithSharedConfig", backendWithSharedConfig);
        RetryConfiguration retryConfiguration = new RetryConfiguration();
        DefaultEventConsumerRegistry<RetryEvent> eventConsumerRegistry = new DefaultEventConsumerRegistry<>();

        RetryRegistry retryRegistry = retryConfiguration
            .retryRegistry(retryConfigurationProperties, eventConsumerRegistry,
                new CompositeRegistryEventConsumer<>(emptyList()), compositeRetryCustomizerTest());

        assertThat(retryRegistry.getAllRetries().size()).isEqualTo(2);
        // Should get default config and overwrite max attempt and wait time
        Retry retry1 = retryRegistry.retry("backendWithDefaultConfig");
        assertThat(retry1).isNotNull();
        assertThat(retry1.getRetryConfig().getMaxAttempts()).isEqualTo(3);
        assertThat(retry1.getRetryConfig().getIntervalBiFunction().apply(1, null)).isEqualTo(200L);
        // Should get shared config and overwrite wait time
        Retry retry2 = retryRegistry.retry("backendWithSharedConfig");
        assertThat(retry2).isNotNull();
        assertThat(retry2.getRetryConfig().getMaxAttempts()).isEqualTo(2);
        assertThat(retry2.getRetryConfig().getIntervalBiFunction().apply(1, null)).isEqualTo(300L);
        // Unknown backend should get default config of Registry
        Retry retry3 = retryRegistry.retry("unknownBackend");
        assertThat(retry3).isNotNull();
        assertThat(retry3.getRetryConfig().getMaxAttempts()).isEqualTo(3);
        assertThat(eventConsumerRegistry.getAllEventConsumer()).hasSize(3);
    }