Skip to content

Commit 69f881b

Browse files
committed
Fix RetryTopicConfigurer bean retrieval.
1 parent 529fd45 commit 69f881b

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

spring-kafka/src/main/java/org/springframework/kafka/annotation/KafkaListenerAnnotationBeanPostProcessor.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -510,14 +510,16 @@ private boolean processMainAndRetryListeners(KafkaListener kafkaListener, Object
510510
}
511511

512512
private RetryTopicConfigurer getRetryTopicConfigurer() {
513-
try {
514-
this.retryTopicConfigurer = this.beanFactory.getBean(RetryTopicBeanNames.RETRY_TOPIC_CONFIGURER_BEAN_NAME,
515-
RetryTopicConfigurer.class);
516-
}
517-
catch (NoSuchBeanDefinitionException ex) {
518-
this.logger.error("A 'RetryTopicConfigurer' with name "
519-
+ RetryTopicBeanNames.RETRY_TOPIC_CONFIGURER_BEAN_NAME + "is required.");
520-
throw ex;
513+
if (this.retryTopicConfigurer == null) {
514+
try {
515+
this.retryTopicConfigurer = this.beanFactory
516+
.getBean(RetryTopicBeanNames.RETRY_TOPIC_CONFIGURER_BEAN_NAME, RetryTopicConfigurer.class);
517+
}
518+
catch (NoSuchBeanDefinitionException ex) {
519+
this.logger.error("A 'RetryTopicConfigurer' with name "
520+
+ RetryTopicBeanNames.RETRY_TOPIC_CONFIGURER_BEAN_NAME + "is required.");
521+
throw ex;
522+
}
521523
}
522524
return this.retryTopicConfigurer;
523525
}

0 commit comments

Comments
 (0)