Enhance @Conditionals for JMX autconfig

Fixes gh-1059
pull/1060/merge
Dave Syer 11 years ago
parent bc85f388aa
commit dcb17a7cb5

@ -22,12 +22,13 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.SearchStrategy;
import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.config.EnableIntegration;
import org.springframework.integration.jmx.config.EnableIntegrationMBeanExport;
import org.springframework.integration.jmx.config.IntegrationMBeanExportConfiguration;
import org.springframework.integration.monitor.IntegrationMBeanExporter;
import org.springframework.jmx.support.MBeanServerFactoryBean;
/**
@ -50,7 +51,7 @@ public class IntegrationAutoConfiguration {
@Configuration
@ConditionalOnClass(EnableIntegrationMBeanExport.class)
@ConditionalOnMissingBean(IntegrationMBeanExportConfiguration.class)
@ConditionalOnMissingBean(value = IntegrationMBeanExporter.class, search = SearchStrategy.CURRENT)
@ConditionalOnExpression("${spring.jmx.enabled:true}")
@EnableIntegrationMBeanExport(defaultDomain = "${spring.jmx.default_domain:}", server = "${spring.jmx.server:mbeanServer}")
protected static class IntegrationJmxConfiguration {

@ -22,6 +22,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.SearchStrategy;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableMBeanExport;
@ -42,7 +43,7 @@ import org.springframework.jmx.support.MBeanServerFactoryBean;
public class JmxAutoConfiguration {
@Configuration
@ConditionalOnMissingBean({ MBeanExporter.class })
@ConditionalOnMissingBean(value = MBeanExporter.class, search = SearchStrategy.CURRENT)
@EnableMBeanExport(defaultDomain = "${spring.jmx.default_domain:}", server = "${spring.jmx.server:mbeanServer}")
public static class MBeanExport {
}

Loading…
Cancel
Save