KafkaBinderConfigurationProperties native changes

- 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.

https://github.com/spring-projects/spring-boot/issues/34507
https://github.com/spring-projects/spring-boot/issues/35564

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2640
This commit is contained in:
Soby Chacko
2023-09-07 16:54:03 -04:00
parent 00672ef5b6
commit bec40fba89

View File

@@ -36,7 +36,6 @@ import org.apache.commons.logging.LogFactory;
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;
@@ -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;