Skip to content

Commit 42e81e9

Browse files
committed
Fix @EnableIntegrationManagement
Restore proper use of `defaultCountsEnabled` that was inadvertently changed to `countsEnabled` Closes gh-12594
1 parent 0b1c293 commit 42e81e9

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public IntegrationMBeanExporter integrationMbeanExporter() {
120120
protected static class IntegrationManagementConfiguration {
121121

122122
@Configuration
123-
@EnableIntegrationManagement(countsEnabled = "true")
123+
@EnableIntegrationManagement(defaultCountsEnabled = "true")
124124
protected static class EnableIntegrationManagementConfiguration {
125125
}
126126

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfigurationTests.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.junit.Test;
2323
import org.junit.rules.ExpectedException;
2424

25+
import org.springframework.beans.DirectFieldAccessor;
2526
import org.springframework.boot.autoconfigure.AutoConfigurations;
2627
import org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration.IntegrationComponentScanAutoConfiguration;
2728
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
@@ -35,7 +36,10 @@
3536
import org.springframework.context.annotation.Primary;
3637
import org.springframework.integration.annotation.IntegrationComponentScan;
3738
import org.springframework.integration.annotation.MessagingGateway;
39+
import org.springframework.integration.core.MessageSource;
40+
import org.springframework.integration.endpoint.MessageProcessorMessageSource;
3841
import org.springframework.integration.gateway.RequestReplyExchanger;
42+
import org.springframework.integration.handler.MessageProcessor;
3943
import org.springframework.integration.support.channel.HeaderChannelRegistry;
4044
import org.springframework.integration.support.management.IntegrationManagementConfigurer;
4145
import org.springframework.jdbc.BadSqlGrammarException;
@@ -196,6 +200,16 @@ public void integrationJdbcDataSourceInitializerEnabledByDefaultWithEmbeddedDb()
196200
});
197201
}
198202

203+
@Test
204+
public void integrationEnablesDefaultCounts() {
205+
this.contextRunner.withUserConfiguration(MessageSourceConfiguration.class)
206+
.run((context) -> {
207+
assertThat(context).hasBean("myMessageSource");
208+
assertThat(new DirectFieldAccessor(context.getBean("myMessageSource"))
209+
.getPropertyValue("countsEnabled")).isEqualTo(true);
210+
});
211+
}
212+
199213
@Configuration
200214
static class CustomMBeanExporter {
201215

@@ -218,4 +232,14 @@ public interface TestGateway extends RequestReplyExchanger {
218232

219233
}
220234

235+
@Configuration
236+
static class MessageSourceConfiguration {
237+
238+
@Bean
239+
public MessageSource<?> myMessageSource() {
240+
return new MessageProcessorMessageSource(mock(MessageProcessor.class));
241+
}
242+
243+
}
244+
221245
}

0 commit comments

Comments
 (0)