Allow user to disable all JMX exports with spring.jmx.enabled

pull/208/head
Dave Syer 11 years ago
parent 561cb3a50f
commit 7d846c835a

@ -39,7 +39,7 @@ import org.springframework.util.StringUtils;
*/ */
@Configuration @Configuration
@AutoConfigureAfter({ EndpointAutoConfiguration.class }) @AutoConfigureAfter({ EndpointAutoConfiguration.class })
@ConditionalOnExpression("${endpoints.jmx.enabled:true}") @ConditionalOnExpression("${endpoints.jmx.enabled:true}&&${spring.jmx.enabled:true}")
@EnableConfigurationProperties(EndpointMBeanExportProperties.class) @EnableConfigurationProperties(EndpointMBeanExportProperties.class)
public class EndpointMBeanExportAutoConfiguration { public class EndpointMBeanExportAutoConfiguration {
@ -55,7 +55,7 @@ public class EndpointMBeanExportAutoConfiguration {
mbeanExporter.setDomain(domain); mbeanExporter.setDomain(domain);
} }
mbeanExporter.setEnsureUniqueRuntimeObjectNames(this.properties.getUniqueNames()); mbeanExporter.setEnsureUniqueRuntimeObjectNames(this.properties.isUniqueNames());
mbeanExporter.setObjectNameStaticProperties(this.properties.getStaticNames()); mbeanExporter.setObjectNameStaticProperties(this.properties.getStaticNames());
return mbeanExporter; return mbeanExporter;
@ -68,8 +68,18 @@ public class EndpointMBeanExportAutoConfiguration {
private boolean uniqueNames = false; private boolean uniqueNames = false;
private boolean enabled = true;
private Properties staticNames = new Properties(); private Properties staticNames = new Properties();
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public String getDomain() { public String getDomain() {
return this.domain; return this.domain;
} }
@ -78,7 +88,7 @@ public class EndpointMBeanExportAutoConfiguration {
this.domain = domain; this.domain = domain;
} }
public boolean getUniqueNames() { public boolean isUniqueNames() {
return this.uniqueNames; return this.uniqueNames;
} }

Loading…
Cancel
Save