Skip to content

Commit

Permalink
KafkaBinderConfigurationProperties native changes
Browse files Browse the repository at this point in the history
 - Earlier, we had to add Autowired on KafkaBinderConfigurationProperties constructor
   as there were some issues with runtime hints generation which caused issues when
   running an app in native mode. Spring Boot fixed these issues and we can remove
   this unnecessary Autowired from the constructor.

See the following issues from Spring Boot for more details.

spring-projects/spring-boot#34507
spring-projects/spring-boot#35564

Resolves spring-cloud#2640
  • Loading branch information
sobychacko authored and omercelikceng committed Sep 14, 2023
1 parent 385307c commit 86510a1
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.producer.ProducerConfig;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
import org.springframework.cloud.stream.binder.HeaderMode;
import org.springframework.cloud.stream.binder.ProducerProperties;
Expand Down Expand Up @@ -146,16 +145,14 @@ public class KafkaBinderConfigurationProperties {
private boolean enableObservation;

/**
* @Autowired on this constructor is necessary for all the properties to be discovered and bound when running as a native
* application.
*
* See the following issue for more details:
*
* https://github.com/spring-cloud/spring-cloud-stream/issues/2644
* Earlier, @Autowired on this constructor was necessary for all the properties to be discovered
* and bound when running as a native application. However, now that Spring Boot fixed the underlying
* issue, we are removing the @Autowired from the constructor. See these Boot issues for more details.
* https://github.com/spring-projects/spring-boot/issues/34507
* https://github.com/spring-projects/spring-boot/issues/35564
*
* @param kafkaProperties Spring Kafka properties autoconfigured by Spring Boot
*/
@Autowired
public KafkaBinderConfigurationProperties(KafkaProperties kafkaProperties) {
Assert.notNull(kafkaProperties, "'kafkaProperties' cannot be null");
this.kafkaProperties = kafkaProperties;
Expand Down

0 comments on commit 86510a1

Please sign in to comment.