
com.buabook.spring.configuration.JmxConfigurator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-common Show documentation
Show all versions of spring-common Show documentation
Spring functionality (c) 2016 Sport Trades Ltd
The newest version!
package com.buabook.spring.configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableMBeanExport;
import org.springframework.jmx.export.MBeanExporter;
import org.springframework.jmx.export.assembler.InterfaceBasedMBeanInfoAssembler;
import com.buabook.spring.jmx.IExposeToJmx;
/**
* Spring JMX Bean Configurator
* This {@link Configuration} class automatically enables all configured Spring resources to be exposed via JMX for administration.
* To allow a Spring resource to be exposed, it must implement the {@link IExposeToJmx} interface.
* (c) 2016 Sport Trades Ltd
*
* @author Jas Rajasansir
* @version 1.0.0
* @since 8 Nov 2016
*/
@Configuration
@EnableMBeanExport
public class JmxConfigurator {
@Bean
public InterfaceBasedMBeanInfoAssembler jmxInterfaceDiscovery() {
InterfaceBasedMBeanInfoAssembler interfaceDiscovery = new InterfaceBasedMBeanInfoAssembler();
interfaceDiscovery.setManagedInterfaces(new Class>[] { IExposeToJmx.class });
return interfaceDiscovery;
}
@Bean
public MBeanExporter jmxBeanExporter() {
MBeanExporter jmx = new MBeanExporter();
jmx.setAssembler(jmxInterfaceDiscovery());
return jmx;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy