Commit 42e81e98 authored by Stephane Nicoll's avatar Stephane Nicoll

Fix @EnableIntegrationManagement

Restore proper use of `defaultCountsEnabled` that was inadvertently
changed to `countsEnabled`

Closes gh-12594
parent 0b1c293e
......@@ -120,7 +120,7 @@ public class IntegrationAutoConfiguration {
protected static class IntegrationManagementConfiguration {
@Configuration
@EnableIntegrationManagement(countsEnabled = "true")
@EnableIntegrationManagement(defaultCountsEnabled = "true")
protected static class EnableIntegrationManagementConfiguration {
}
......
......@@ -22,6 +22,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration.IntegrationComponentScanAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
......@@ -35,7 +36,10 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.integration.annotation.IntegrationComponentScan;
import org.springframework.integration.annotation.MessagingGateway;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.endpoint.MessageProcessorMessageSource;
import org.springframework.integration.gateway.RequestReplyExchanger;
import org.springframework.integration.handler.MessageProcessor;
import org.springframework.integration.support.channel.HeaderChannelRegistry;
import org.springframework.integration.support.management.IntegrationManagementConfigurer;
import org.springframework.jdbc.BadSqlGrammarException;
......@@ -196,6 +200,16 @@ public class IntegrationAutoConfigurationTests {
});
}
@Test
public void integrationEnablesDefaultCounts() {
this.contextRunner.withUserConfiguration(MessageSourceConfiguration.class)
.run((context) -> {
assertThat(context).hasBean("myMessageSource");
assertThat(new DirectFieldAccessor(context.getBean("myMessageSource"))
.getPropertyValue("countsEnabled")).isEqualTo(true);
});
}
@Configuration
static class CustomMBeanExporter {
......@@ -218,4 +232,14 @@ public class IntegrationAutoConfigurationTests {
}
@Configuration
static class MessageSourceConfiguration {
@Bean
public MessageSource<?> myMessageSource() {
return new MessageProcessorMessageSource(mock(MessageProcessor.class));
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment