|
51 | 51 | import org.springframework.kafka.config.KafkaListenerContainerFactory;
|
52 | 52 | import org.springframework.kafka.config.KafkaStreamsConfiguration;
|
53 | 53 | import org.springframework.kafka.config.StreamsBuilderFactoryBean;
|
| 54 | +import org.springframework.kafka.core.ConsumerFactory; |
54 | 55 | import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
|
55 | 56 | import org.springframework.kafka.core.DefaultKafkaProducerFactory;
|
56 | 57 | import org.springframework.kafka.core.KafkaAdmin;
|
@@ -575,6 +576,16 @@ void testConcurrentKafkaListenerContainerFactoryWithKafkaTemplate() {
|
575 | 576 | });
|
576 | 577 | }
|
577 | 578 |
|
| 579 | + @Test |
| 580 | + void testConcurrentKafkaListenerContainerFactoryWithCustomConsumerFactory() { |
| 581 | + this.contextRunner.withUserConfiguration(ConsumerFactoryConfiguration.class).run((context) -> { |
| 582 | + ConcurrentKafkaListenerContainerFactory<?, ?> kafkaListenerContainerFactory = context |
| 583 | + .getBean(ConcurrentKafkaListenerContainerFactory.class); |
| 584 | + assertThat(kafkaListenerContainerFactory.getConsumerFactory()) |
| 585 | + .isNotSameAs(context.getBean(ConsumerFactoryConfiguration.class).consumerFactory); |
| 586 | + }); |
| 587 | + } |
| 588 | + |
578 | 589 | @Test
|
579 | 590 | void specificSecurityProtocolOverridesCommonSecurityProtocol() {
|
580 | 591 | this.contextRunner.withPropertyValues("spring.kafka.security.protocol=SSL",
|
@@ -653,6 +664,18 @@ AfterRollbackProcessor<Object, Object> afterRollbackProcessor() {
|
653 | 664 |
|
654 | 665 | }
|
655 | 666 |
|
| 667 | + @Configuration(proxyBeanMethods = false) |
| 668 | + static class ConsumerFactoryConfiguration { |
| 669 | + |
| 670 | + private final ConsumerFactory<String, Object> consumerFactory = mock(ConsumerFactory.class); |
| 671 | + |
| 672 | + @Bean |
| 673 | + ConsumerFactory<String, Object> myConsumerFactory() { |
| 674 | + return this.consumerFactory; |
| 675 | + } |
| 676 | + |
| 677 | + } |
| 678 | + |
656 | 679 | @Configuration(proxyBeanMethods = false)
|
657 | 680 | static class RecordInterceptorConfiguration {
|
658 | 681 |
|
|
0 commit comments