From 8b33104b8dcd1baa86855c1f4186810bd4c00af6 Mon Sep 17 00:00:00 2001 From: omercelik Date: Mon, 14 Aug 2023 20:13:51 +0300 Subject: [PATCH] GH-2787: NestedConfigurationProperties for native Nested configurations(BindingProperties(ConsumerProperties and ProducerProperties)) in the BindingServiceProperties class do not work when built with native image. For this reason, the consumer and producer properties under the Bindings configuration do not work. Adding @NestedConfigurationProperty annotation on the property fields in BindingProperties. For more info see https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html#native-image.advanced Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2787 --- .../cloud/stream/config/BindingProperties.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingProperties.java b/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingProperties.java index 6245efc32..7b0e2765c 100644 --- a/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingProperties.java +++ b/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingProperties.java @@ -19,6 +19,7 @@ package org.springframework.cloud.stream.config; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; +import org.springframework.boot.context.properties.NestedConfigurationProperty; import org.springframework.cloud.stream.binder.ConsumerProperties; import org.springframework.cloud.stream.binder.ProducerProperties; import org.springframework.util.MimeType; @@ -33,6 +34,7 @@ import org.springframework.validation.annotation.Validated; * @author Gary Russell * @author Soby Chacko * @author Oleg Zhurakousky + * @author Omer Celik */ @JsonInclude(Include.NON_DEFAULT) @Validated @@ -82,11 +84,13 @@ public class BindingProperties { /** * Additional consumer specific properties (see {@link ConsumerProperties}). */ + @NestedConfigurationProperty private ConsumerProperties consumer; /** * Additional producer specific properties (see {@link ProducerProperties}). */ + @NestedConfigurationProperty private ProducerProperties producer; public String getDestination() {