I am using springboot + kafka. I did all the factory definitions in the yml file there is no code creating factories etc, all in yml file.
Now I need to make it secure however I couldn't find how to add ssl.enabled.protocols
in the application.yml
file.
I don't want to create @Bean
definitions or @Configuration
files as I want to configure everything from the yml file or at least only somehow inject ssl.enabled.protocols
from the code.
Is there a way to customize the factory so that I wouldn't need to move all the configuration definitions into the code but only the missing part.
You can set arbitrary properties (those that are not directly supported by Boot) using spring.kafka.properties[some.property]=foo
.
The properties supported by auto configuration are shown in the “Integration Properties” section of the Appendix. Note that, for the most part, these properties (hyphenated or camelCase) map directly to the Apache Kafka dotted properties. See the Apache Kafka documentation for details.
The first few of these properties apply to all components (producers, consumers, admins, and streams) but can be specified at the component level if you wish to use different values. Apache Kafka designates properties with an importance of HIGH, MEDIUM, or LOW. Spring Boot auto-configuration supports all HIGH importance properties, some selected MEDIUM and LOW properties, and any properties that do not have a default value.
Only a subset of the properties supported by Kafka are available directly through the KafkaProperties class. If you wish to configure the producer or consumer with additional properties that are not directly supported, use the following properties:
spring.kafka.properties[prop.one]=first
spring.kafka.admin.properties[prop.two]=second
spring.kafka.consumer.properties[prop.three]=third
spring.kafka.producer.properties[prop.four]=fourth
spring.kafka.streams.properties[prop.five]=fifth
This sets the common prop.one Kafka property to first (applies to producers, consumers and admins), the prop.two admin property to second, the prop.three consumer property to third, the prop.four producer property to fourth and the prop.five streams property to fifth.
Additional properties, common to producers and consumers, used to configure the client.
The SSL properties directly supported by Boot are shown here: