Merge branch '2.0.x'

pull/13019/head
Stephane Nicoll 7 years ago
commit 0819822eb6

@ -23,6 +23,7 @@ import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@ -77,6 +78,7 @@ public class IntegrationAutoConfiguration {
@Configuration
@ConditionalOnClass(EnableIntegrationMBeanExport.class)
@ConditionalOnMissingBean(value = IntegrationMBeanExporter.class, search = SearchStrategy.CURRENT)
@ConditionalOnBean(MBeanServer.class)
@ConditionalOnProperty(prefix = "spring.jmx", name = "enabled", havingValue = "true", matchIfMissing = true)
protected static class IntegrationJmxConfiguration
implements EnvironmentAware, BeanFactoryAware {

@ -85,6 +85,18 @@ public class IntegrationAutoConfigurationTests {
});
}
@Test
public void noMBeanServerAvailable() {
ApplicationContextRunner contextRunnerWithoutJmx = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(
IntegrationAutoConfiguration.class));
contextRunnerWithoutJmx.run((context) -> {
assertThat(context).hasSingleBean(TestGateway.class);
assertThat(context)
.hasSingleBean(IntegrationComponentScanConfiguration.class);
});
}
@Test
public void parentContext() {
this.contextRunner.run((context) -> this.contextRunner.withParent(context)

Loading…
Cancel
Save