diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java index e2e10714a23..4209d30c6dd 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java @@ -66,7 +66,7 @@ public class KafkaProperties { * Additional properties, common to producers and consumers, used to configure the * client. */ - private Map properties = new HashMap<>(); + private final Map properties = new HashMap<>(); private final Consumer consumer = new Consumer(); @@ -100,10 +100,6 @@ public class KafkaProperties { return this.properties; } - public void setProperties(Map properties) { - this.properties = properties; - } - public Consumer getConsumer() { return this.consumer; } @@ -270,9 +266,9 @@ public class KafkaProperties { private Integer maxPollRecords; /** - * Additional properties used to configure the client. + * Additional consumer-specific properties used to configure the client. */ - private Map properties = new HashMap<>(); + private final Map properties = new HashMap<>(); public Ssl getSsl() { return this.ssl; @@ -378,10 +374,6 @@ public class KafkaProperties { return this.properties; } - public void setProperties(Map properties) { - this.properties = properties; - } - public Map buildProperties() { Map properties = new HashMap<>(); if (this.autoCommitInterval != null) { @@ -508,9 +500,9 @@ public class KafkaProperties { private Integer retries; /** - * Additional properties used to configure the client. + * Additional producer-specific properties used to configure the client. */ - private Map properties = new HashMap<>(); + private final Map properties = new HashMap<>(); public Ssl getSsl() { return this.ssl; @@ -592,10 +584,6 @@ public class KafkaProperties { return this.properties; } - public void setProperties(Map properties) { - this.properties = properties; - } - public Map buildProperties() { Map properties = new HashMap<>(); if (this.acks != null) { diff --git a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index 20d2f676b13..fbbb3ffa337 100644 --- a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -968,7 +968,7 @@ content into your application; rather pick only the properties that you need. spring.kafka.consumer.heartbeat-interval= # Expected time in milliseconds between heartbeats to the consumer coordinator. spring.kafka.consumer.key-deserializer= # Deserializer class for keys. spring.kafka.consumer.max-poll-records= # Maximum number of records returned in a single call to poll(). - spring.kafka.consumer.properties.*= # Additional properties used to configure the client. + spring.kafka.consumer.properties.*= # Additional consumer-specific properties used to configure the client. spring.kafka.consumer.ssl.key-password= # Password of the private key in the key store file. spring.kafka.consumer.ssl.keystore-location= # Location of the key store file. spring.kafka.consumer.ssl.keystore-password= # Store password for the key store file. @@ -992,7 +992,7 @@ content into your application; rather pick only the properties that you need. spring.kafka.producer.client-id= # Id to pass to the server when making requests; used for server-side logging. spring.kafka.producer.compression-type= # Compression type for all data generated by the producer. spring.kafka.producer.key-serializer= # Serializer class for keys. - spring.kafka.producer.properties.*= # Additional properties used to configure the client. + spring.kafka.producer.properties.*= # Additional producer-specific properties used to configure the client. spring.kafka.producer.retries= # When greater than zero, enables retrying of failed sends. spring.kafka.producer.ssl.key-password= # Password of the private key in the key store file. spring.kafka.producer.ssl.keystore-location= # Location of the key store file. diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index cea47c15d43..9ce15fab0f3 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -5121,9 +5121,12 @@ are not directly supported, use the following: spring,kafka.producer.properties.baz.qux=fiz ---- -This sets the common `foo.bar` Kafka property to `baz` (applies to both producers and consumers), the consumer `fiz.buz` property to `qux` and the `baz.qux` producer property to `fiz`. +This sets the common `foo.bar` Kafka property to `baz` (applies to both producers and +consumers), the consumer `fiz.buz` property to `qux` and the `baz.qux` producer property +to `fiz`. -IMPORTANT: Properties set in this way will override properties that are in the subset that boot explicitly supports. +IMPORTANT: Properties set in this way will override any configuration item that Spring +Boot explicitly supports. [[boot-features-resttemplate]] == Calling REST services with '`RestTemplate`'