java jmx整合Spring配置

    xiaoxiao2022-06-23  16

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> MBeanExporter,被监控的bean需要在此注册 <bean id="exporter" class="org.springframework.jmx.export.MBeanExporter"> <property name="beans"> <map> <entry key="mydomain:myjavaobj=Xxx" value-ref="xxx" /> </map> </property> <property name="assembler" ref="assembler" /> </bean> 配置被监控的bean向外暴露的接口,此处com.xxx.impl.xxx为被监控bean需要继承的接口 <bean id="assembler" class="org.springframework.jmx.export.assembler.InterfaceBasedMBeanInfoAssembler"> <property name="managedInterfaces"> <list> <value>com.xxx.impl.xxx</value> </list> </property> </bean> 被监控bean <bean name="xxx" class="com.xxx.Xxx"> <property name="xxa" value="20000" /> <property name="xxb" value="40000" /> </bean> 连接服务器配置,提供给远程管理管理层的接口 <bean id="server" class="org.springframework.jmx.support.ConnectorServerFactoryBean" depends-on="registry"> <property name="objectName"> <value>connector:name=rmi</value> </property> <property name="serviceUrl"> <value>service:jmx:rmi://localhost/jndi/rmi://localhost:1099/jmxrmi</value> </property> </bean> <bean id="registry" class="org.springframework.remoting.rmi.RmiRegistryFactoryBean"> <property name="port"> <value>1099</value> </property> </bean> </beans>
    转载请注明原文地址: https://ju.6miu.com/read-1123368.html

    最新回复(0)