How to configure CommonErrorHandler and ContainerProperties through application.properties in spring boot?

Viewed 561

As we know, we do not require to define ConcurrentKafkaListenerContainerFactory bean definition in spring boot with kafka instead we could configure them by these properties. But I could not find any properties at this link to configure errohandler / retrytemplate / commonerrorhandler / ContainerProperties. So because of this again I have to define the custom java bean definition and configure it. Do we have any alternate solution to achieve it through application.properties?

1 Answers

RetryTemplate in the container factory is deprecated now that the error handlers support back off and exception classification.

With Spring Boot, all you need to do is add the CommonErrorHandler (e.g. DefaultErrorHandler as a @Bean and Boot will automatically wired it into the factory.

If you need to modify container properties that are not supported directly as Boot properties, you can simply add Boot's container factory as a parameter to any @Bean factory method and update the properties there.

Related