My question may sound weird, but still.
Is it possible to use spring-kafka
only as a configuration framework - like parsing application.properties
or application.yaml
and instantiate consumer and producer without Spring Boot Autoconfiguration facilities? Basically, minimal sprinkles of spring
and spring-kafka
for just public static void main
application.
Thank you
Not sure what you mean with a "configuration framework", but from your description it sounds like you still want to use spring-kafka
. So, there is nothing wrong to have a PropertySourcesPlaceholderConfigurer
to resolve @Value
annotations for configuration properties against your application.properties
in the @PropertySource
.
See docs for more info: https://docs.spring.io/spring/docs/5.2.4.RELEASE/spring-framework-reference/core.html#beans
See sample in Spring for Apache Kafka docs how to configure spring-kafka
without Spring Boot: https://docs.spring.io/spring-kafka/docs/2.4.3.RELEASE/reference/html/#with-java-configuration
So, you need to combine spring-kafka
feature with that @PropertySource
+ @Value
for parsing configuration properties.
Essentially you are going to do whatever Spring Boot does for you ;-)