diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java index 17501e389e..615ef47158 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java @@ -87,18 +87,13 @@ public class RabbitProperties { @DurationUnit(ChronoUnit.SECONDS) private Duration requestedHeartbeat; - /** - * Whether to enable publisher confirms. - */ - private boolean publisherConfirms; - /** * Whether to enable publisher returns. */ private boolean publisherReturns; /** - * The type of publisher confirms to use. + * Type of publisher confirms to use. */ private ConfirmType publisherConfirmType; @@ -280,17 +275,15 @@ public class RabbitProperties { this.requestedHeartbeat = requestedHeartbeat; } + @DeprecatedConfigurationProperty(reason = "replaced to support additional confirm types", + replacement = "spring.rabbitmq.publisher-confirm-type") public boolean isPublisherConfirms() { return this.publisherConfirmType.equals(ConfirmType.CORRELATED); } @Deprecated public void setPublisherConfirms(boolean publisherConfirms) { - if (publisherConfirms) { - this.publisherConfirmType = ConfirmType.CORRELATED; - return; - } - this.publisherConfirmType = ConfirmType.NONE; + this.publisherConfirmType = (publisherConfirms) ? ConfirmType.CORRELATED : ConfirmType.NONE; } public boolean isPublisherReturns() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java index b7fc88f88d..874219d115 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java @@ -80,6 +80,7 @@ import static org.mockito.Mockito.verify; * @author Greg Turnquist * @author Stephane Nicoll * @author Gary Russell + * @author HaiTao Zhang */ class RabbitAutoConfigurationTests {