When working with multiple Kafka broker configurations in a Spring Boot application, defining multiple KafkaProperties beans results in an error during autowiring in KafkaAnnotationDrivenConfiguration. The workaround I used is to define the defaultKafkaProperties bean with @Primary annotation.

But I am wondering why there's no default qualifier in autoconfiguration code?

Proposed enhancement: Add default qualifier Kafka auto-configuration code to allow multiple broker configurations coexist seamlessly.

This change would prevent autowiring conflicts when multiple KafkaProperties beans exist and add more flexibilit for multi-broker configurations.

I'm willing to contribute to this enhancement if the team finds it valuable.

Comment From: snicoll

What you describe is the expected behavior. Auto-configuration is for one broker only and expects such types to be uniquely identified. From that perspective, adding a qualifier in the auto-configuration makes no sense.

You may be interested by the multiple datasources example in the reference guide