All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.buabook.spring.configuration.JmxConfigurator Maven / Gradle / Ivy

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