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
This commit is contained in:
omercelik
2023-08-14 20:13:51 +03:00
committed by Soby Chacko
parent d3e85a527b
commit 8b33104b8d

View File

@@ -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() {