diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsProperties.java index 337ee8c9ef..097a8d5dea 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsProperties.java @@ -146,7 +146,8 @@ public class JmsProperties { private AcknowledgeMode acknowledgeMode; /** - * Minimum number of concurrent consumers. + * Minimum number of concurrent consumers. When max-concurrency is not specified + * the minimum will also be used as the maximum. */ private Integer concurrency; @@ -198,8 +199,7 @@ public class JmsProperties { if (this.concurrency == null) { return (this.maxConcurrency != null) ? "1-" + this.maxConcurrency : null; } - return ((this.maxConcurrency != null) ? this.concurrency + "-" + this.maxConcurrency - : String.valueOf(this.concurrency)); + return this.concurrency + "-" + ((this.maxConcurrency != null) ? this.maxConcurrency : this.concurrency); } public Duration getReceiveTimeout() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsPropertiesTests.java index 7ddbecd5c8..8e42211c06 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsPropertiesTests.java @@ -41,7 +41,7 @@ class JmsPropertiesTests { void formatConcurrencyOnlyLowerBound() { JmsProperties properties = new JmsProperties(); properties.getListener().setConcurrency(2); - assertThat(properties.getListener().formatConcurrency()).isEqualTo("2"); + assertThat(properties.getListener().formatConcurrency()).isEqualTo("2-2"); } @Test