Set JMX export on by default
This commit is contained in:
parent
d04248a845
commit
b694556483
|
|
@ -25,18 +25,18 @@ import org.springframework.context.annotation.EnableMBeanExport;
|
|||
import org.springframework.jmx.export.MBeanExporter;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} to enable/disiable Spring's
|
||||
* {@link EnableAutoConfiguration Auto-configuration} to enable/disable Spring's
|
||||
* {@link EnableMBeanExport} mechanism based on configuration properties.
|
||||
*
|
||||
* <p>
|
||||
* To enable auto export of annotation beans set <code>spring.jmx.enabled: true</code>.
|
||||
* To disable auto export of annotation beans set <code>spring.jmx.enabled: false</code>.
|
||||
*
|
||||
* @author Christian Dupuis
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass({ MBeanExporter.class })
|
||||
@ConditionalOnMissingBean({ MBeanExporter.class })
|
||||
@ConditionalOnExpression("${spring.jmx.enabled:false}")
|
||||
@ConditionalOnExpression("${spring.jmx.enabled:true}")
|
||||
public class JmxAutoConfiguration {
|
||||
|
||||
@Configuration
|
||||
|
|
|
|||
|
|
@ -56,8 +56,7 @@ public class JmxAutoConfigurationTests {
|
|||
this.context = new AnnotationConfigApplicationContext();
|
||||
this.context.register(JmxAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
this.thrown.expect(NoSuchBeanDefinitionException.class);
|
||||
this.context.getBean(MBeanExporter.class);
|
||||
assertNotNull(this.context.getBean(MBeanExporter.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in New Issue