Add a config prop to enable/disable SI's default logging
See gh-28355
This commit is contained in:
parent
14fb9c437d
commit
c6891c5184
|
@ -209,7 +209,8 @@ public class IntegrationAutoConfiguration {
|
|||
protected static class IntegrationManagementConfiguration {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableIntegrationManagement
|
||||
@EnableIntegrationManagement(
|
||||
defaultLoggingEnabled = "${spring.integration.management.default-logging-enabled:true}")
|
||||
protected static class EnableIntegrationManagementConfiguration {
|
||||
|
||||
}
|
||||
|
|
|
@ -47,6 +47,8 @@ public class IntegrationProperties {
|
|||
|
||||
private final Poller poller = new Poller();
|
||||
|
||||
private final Management management = new Management();
|
||||
|
||||
public Channel getChannel() {
|
||||
return this.channel;
|
||||
}
|
||||
|
@ -71,6 +73,10 @@ public class IntegrationProperties {
|
|||
return this.poller;
|
||||
}
|
||||
|
||||
public Management getManagement() {
|
||||
return this.management;
|
||||
}
|
||||
|
||||
public static class Channel {
|
||||
|
||||
/**
|
||||
|
@ -386,4 +392,21 @@ public class IntegrationProperties {
|
|||
|
||||
}
|
||||
|
||||
public static class Management {
|
||||
|
||||
/**
|
||||
* Logging management in the integration components.
|
||||
*/
|
||||
boolean defaultLoggingEnabled = true;
|
||||
|
||||
public boolean isDefaultLoggingEnabled() {
|
||||
return this.defaultLoggingEnabled;
|
||||
}
|
||||
|
||||
public void setDefaultLoggingEnabled(boolean defaultLoggingEnabled) {
|
||||
this.defaultLoggingEnabled = defaultLoggingEnabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ import org.springframework.core.io.ResourceLoader;
|
|||
import org.springframework.integration.annotation.IntegrationComponentScan;
|
||||
import org.springframework.integration.annotation.MessagingGateway;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.integration.config.IntegrationManagementConfigurer;
|
||||
import org.springframework.integration.context.IntegrationContextUtils;
|
||||
|
@ -484,6 +485,14 @@ class IntegrationAutoConfigurationTests {
|
|||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void integrationManagementLoggingDisabled() {
|
||||
this.contextRunner.withPropertyValues("spring.integration.management.defaultLoggingEnabled=false")
|
||||
.withBean(DirectChannel.class, DirectChannel::new).run((context) -> assertThat(context)
|
||||
.getBean(DirectChannel.class).extracting(DirectChannel::isLoggingEnabled).isEqualTo(false));
|
||||
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class CustomMBeanExporter {
|
||||
|
||||
|
|
Loading…
Reference in New Issue