spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.4k stars 40.75k forks source link

Fail fast if a Kafka property is configured in spring.kafka.properties when a spring.kafka property could have been used instead #35694

Open robtha opened 1 year ago

robtha commented 1 year ago

After upgraded to spring boot 3.1.0 configuration of kafka server via configuration property spring.kafka.properties.bootstrap.servers no longer working.

Always using default value localhost:9092 and therefore unable to connect.

Workaround to make it work is using configuration property spring.kafka.bootstrapServers but I don't think this is the intended way for configuration.

wilkinsona commented 1 year ago

Workaround to make it work is using configuration property spring.kafka.bootstrapServers but I don't think this is the intended way for configuration.

This is the intended way.

kafka server via configuration property spring.kafka.properties.bootstrap.servers no longer working

spring.kafka.properties.* configuration is for "Additional properties, common to producers and consumers, used to configure the client". In other words, it's for configuring Kafka settings for which Spring Boot does not have a specific property.

That said, even if it wasn't intended, this worked in previous versions. We should consider if we want to reinstate that behavior to make upgrades easier. It would require PropertiesKafkaConnectionDetails to consider entries in the spring.kafka.properties map.

robtha commented 1 year ago

@wilkinsona thanks for clarifying

wilkinsona commented 1 year ago

We've decided not to reinstate the previous behaviour as it wasn't intentional. We're going to tighten things up and fail-fast if one of Boot's properties is configured in the spring.kafka.properties map of additional properties.

stillya commented 1 year ago

@wilkinsona Hello, I've created PR to close this issue. Could you take a look when you get a chance?