@Test public void testCreateBulkHeadRegistryWithUnknownConfig() { BulkheadConfigurationProperties bulkheadConfigurationProperties = new BulkheadConfigurationProperties(); io.github.resilience4j.common.bulkhead.configuration.BulkheadConfigurationProperties.InstanceProperties instanceProperties = new io.github.resilience4j.common.bulkhead.configuration.BulkheadConfigurationProperties.InstanceProperties(); instanceProperties.setBaseConfig("unknownConfig"); bulkheadConfigurationProperties.getInstances().put("backend", instanceProperties); BulkheadConfiguration bulkheadConfiguration = new BulkheadConfiguration(); DefaultEventConsumerRegistry<BulkheadEvent> eventConsumerRegistry = new DefaultEventConsumerRegistry<>(); assertThatThrownBy(() -> bulkheadConfiguration .bulkheadRegistry(bulkheadConfigurationProperties, eventConsumerRegistry, new CompositeRegistryEventConsumer<>(emptyList()), new CompositeCustomizer<>(Collections.emptyList()))) .isInstanceOf(ConfigurationNotFoundException.class) .hasMessage("Configuration with name 'unknownConfig' does not exist"); }
@Bean public BulkheadRegistry bulkheadRegistry( BulkheadConfigurationProperties bulkheadConfigurationProperties, EventConsumerRegistry<BulkheadEvent> bulkheadEventConsumerRegistry, RegistryEventConsumer<Bulkhead> bulkheadRegistryEventConsumer, @Qualifier("compositeBulkheadCustomizer") CompositeCustomizer<BulkheadConfigCustomizer> compositeBulkheadCustomizer) { BulkheadRegistry bulkheadRegistry = createBulkheadRegistry(bulkheadConfigurationProperties, bulkheadRegistryEventConsumer, compositeBulkheadCustomizer); registerEventConsumer(bulkheadRegistry, bulkheadEventConsumerRegistry, bulkheadConfigurationProperties); bulkheadConfigurationProperties.getInstances().forEach((name, properties) -> bulkheadRegistry .bulkhead(name, bulkheadConfigurationProperties .createBulkheadConfig(properties, compositeBulkheadCustomizer, name))); return bulkheadRegistry; }
BulkheadConfiguration { @Bean public BulkheadRegistry bulkheadRegistry( BulkheadConfigurationProperties bulkheadConfigurationProperties, EventConsumerRegistry<BulkheadEvent> bulkheadEventConsumerRegistry, RegistryEventConsumer<Bulkhead> bulkheadRegistryEventConsumer, @Qualifier("compositeBulkheadCustomizer") CompositeCustomizer<BulkheadConfigCustomizer> compositeBulkheadCustomizer) { BulkheadRegistry bulkheadRegistry = createBulkheadRegistry(bulkheadConfigurationProperties, bulkheadRegistryEventConsumer, compositeBulkheadCustomizer); registerEventConsumer(bulkheadRegistry, bulkheadEventConsumerRegistry, bulkheadConfigurationProperties); bulkheadConfigurationProperties.getInstances().forEach((name, properties) -> bulkheadRegistry .bulkhead(name, bulkheadConfigurationProperties .createBulkheadConfig(properties, compositeBulkheadCustomizer, name))); return bulkheadRegistry; } }
BulkheadConfiguration { @Bean public BulkheadRegistry bulkheadRegistry( BulkheadConfigurationProperties bulkheadConfigurationProperties, EventConsumerRegistry<BulkheadEvent> bulkheadEventConsumerRegistry, RegistryEventConsumer<Bulkhead> bulkheadRegistryEventConsumer, @Qualifier("compositeBulkheadCustomizer") CompositeCustomizer<BulkheadConfigCustomizer> compositeBulkheadCustomizer) { BulkheadRegistry bulkheadRegistry = createBulkheadRegistry(bulkheadConfigurationProperties, bulkheadRegistryEventConsumer, compositeBulkheadCustomizer); registerEventConsumer(bulkheadRegistry, bulkheadEventConsumerRegistry, bulkheadConfigurationProperties); bulkheadConfigurationProperties.getInstances().forEach((name, properties) -> bulkheadRegistry .bulkhead(name, bulkheadConfigurationProperties .createBulkheadConfig(properties, compositeBulkheadCustomizer, name))); return bulkheadRegistry; }  }
BulkheadConfiguration { @Bean public BulkheadRegistry bulkheadRegistry( BulkheadConfigurationProperties bulkheadConfigurationProperties, EventConsumerRegistry<BulkheadEvent> bulkheadEventConsumerRegistry, RegistryEventConsumer<Bulkhead> bulkheadRegistryEventConsumer, @Qualifier("compositeBulkheadCustomizer") CompositeCustomizer<BulkheadConfigCustomizer> compositeBulkheadCustomizer) { BulkheadRegistry bulkheadRegistry = createBulkheadRegistry(bulkheadConfigurationProperties, bulkheadRegistryEventConsumer, compositeBulkheadCustomizer); registerEventConsumer(bulkheadRegistry, bulkheadEventConsumerRegistry, bulkheadConfigurationProperties); bulkheadConfigurationProperties.getInstances().forEach((name, properties) -> bulkheadRegistry .bulkhead(name, bulkheadConfigurationProperties .createBulkheadConfig(properties, compositeBulkheadCustomizer, name))); return bulkheadRegistry; }  @Bean @Qualifier("compositeBulkheadCustomizer") CompositeCustomizer<BulkheadConfigCustomizer> compositeBulkheadCustomizer(
        @Autowired(required = false) List<BulkheadConfigCustomizer> customizers); @Bean BulkheadRegistry bulkheadRegistry(
        BulkheadConfigurationProperties bulkheadConfigurationProperties,
        EventConsumerRegistry<BulkheadEvent> bulkheadEventConsumerRegistry,
        RegistryEventConsumer<Bulkhead> bulkheadRegistryEventConsumer,
        @Qualifier("compositeBulkheadCustomizer") CompositeCustomizer<BulkheadConfigCustomizer> compositeBulkheadCustomizer); @Bean @Primary RegistryEventConsumer<Bulkhead> bulkheadRegistryEventConsumer(
        Optional<List<RegistryEventConsumer<Bulkhead>>> optionalRegistryEventConsumers); @Bean @Conditional(value = {AspectJOnClasspathCondition.class}) BulkheadAspect bulkheadAspect(
        BulkheadConfigurationProperties bulkheadConfigurationProperties,
        ThreadPoolBulkheadRegistry threadPoolBulkheadRegistry,
        BulkheadRegistry bulkheadRegistry,
        @Autowired(required = false) List<BulkheadAspectExt> bulkHeadAspectExtList,
        FallbackDecorators fallbackDecorators,
        SpelResolver spelResolver
    ); @Bean @Conditional(value = {RxJava2OnClasspathCondition.class, AspectJOnClasspathCondition.class}) RxJava2BulkheadAspectExt rxJava2BulkHeadAspectExt(); @Bean @Conditional(value = {ReactorOnClasspathCondition.class, AspectJOnClasspathCondition.class}) ReactorBulkheadAspectExt reactorBulkHeadAspectExt(); @Bean EventConsumerRegistry<BulkheadEvent> bulkheadEventConsumerRegistry(); }
BulkheadConfiguration { @Bean public BulkheadRegistry bulkheadRegistry( BulkheadConfigurationProperties bulkheadConfigurationProperties, EventConsumerRegistry<BulkheadEvent> bulkheadEventConsumerRegistry, RegistryEventConsumer<Bulkhead> bulkheadRegistryEventConsumer, @Qualifier("compositeBulkheadCustomizer") CompositeCustomizer<BulkheadConfigCustomizer> compositeBulkheadCustomizer) { BulkheadRegistry bulkheadRegistry = createBulkheadRegistry(bulkheadConfigurationProperties, bulkheadRegistryEventConsumer, compositeBulkheadCustomizer); registerEventConsumer(bulkheadRegistry, bulkheadEventConsumerRegistry, bulkheadConfigurationProperties); bulkheadConfigurationProperties.getInstances().forEach((name, properties) -> bulkheadRegistry .bulkhead(name, bulkheadConfigurationProperties .createBulkheadConfig(properties, compositeBulkheadCustomizer, name))); return bulkheadRegistry; }  @Bean @Qualifier("compositeBulkheadCustomizer") CompositeCustomizer<BulkheadConfigCustomizer> compositeBulkheadCustomizer(
        @Autowired(required = false) List<BulkheadConfigCustomizer> customizers); @Bean BulkheadRegistry bulkheadRegistry(
        BulkheadConfigurationProperties bulkheadConfigurationProperties,
        EventConsumerRegistry<BulkheadEvent> bulkheadEventConsumerRegistry,
        RegistryEventConsumer<Bulkhead> bulkheadRegistryEventConsumer,
        @Qualifier("compositeBulkheadCustomizer") CompositeCustomizer<BulkheadConfigCustomizer> compositeBulkheadCustomizer); @Bean @Primary RegistryEventConsumer<Bulkhead> bulkheadRegistryEventConsumer(
        Optional<List<RegistryEventConsumer<Bulkhead>>> optionalRegistryEventConsumers); @Bean @Conditional(value = {AspectJOnClasspathCondition.class}) BulkheadAspect bulkheadAspect(
        BulkheadConfigurationProperties bulkheadConfigurationProperties,
        ThreadPoolBulkheadRegistry threadPoolBulkheadRegistry,
        BulkheadRegistry bulkheadRegistry,
        @Autowired(required = false) List<BulkheadAspectExt> bulkHeadAspectExtList,
        FallbackDecorators fallbackDecorators,
        SpelResolver spelResolver
    ); @Bean @Conditional(value = {RxJava2OnClasspathCondition.class, AspectJOnClasspathCondition.class}) RxJava2BulkheadAspectExt rxJava2BulkHeadAspectExt(); @Bean @Conditional(value = {ReactorOnClasspathCondition.class, AspectJOnClasspathCondition.class}) ReactorBulkheadAspectExt reactorBulkHeadAspectExt(); @Bean EventConsumerRegistry<BulkheadEvent> bulkheadEventConsumerRegistry();  }