Home > Blockchain >  StreamsBuilderFactoryBeanCustomizer vs StreamsBuilderFactoryBeanConfigurer
StreamsBuilderFactoryBeanCustomizer vs StreamsBuilderFactoryBeanConfigurer

Time:01-14

StreamsBuilderFactoryBeanCustomizer and StreamsBuilderFactoryBeanConfigurer are both used to customize the StreamsBuilderFactoryBean. These 2 interfaces seem redundant and one of the two should certainly be deprecated before being abandoned.

This works well when using the default Spring configuration but it can become a pain when custom StreamsBuilderFactoryBean(s) need(s) to be created.

Any specific reason/constraint explaining the need of these 2 interfaces? Any feedback is more than welcome.

CodePudding user response:

StreamsBuilderFactoryBeanConfigurer is provided by Spring for Apache Kafka.

The customizer is a Spring Boot class.

Not all users use Spring Boot although, admittedly, most do. Furthermore, the ...Configurer extends Ordered so you can control the order in which multiple configurers are invoked.

It used to be worse - they were both called ...Customizer until Spring for Apache Kafka version 2.6.7.

https://github.com/spring-projects/spring-kafka/issues/1736

They were added to their respective projects:

Spring for Apache Kafka: Feb 28 2019 https://github.com/spring-projects/spring-kafka/commit/9e86163647217dd9cefb5e35c974eb476cefc150

Spring Boot: Jul 1, 2020: https://github.com/spring-projects/spring-boot/commit/54e0a61b425d00ceb220b82dc8abbad121245c10

So, it appears that Boot added its own customizer unnecessarily.

You could try opening an issue against Boot to see if they are prepared to deprecate theirs (since ours predates it), but we can't remove it from Spring for Apache Kafka for reasons stated.

  • Related