java jmx整合Spring配置

来源:互联网 发布:知足知不足阅读答案 编辑:程序博客网 时间:2024/05/21 11:04
<?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>

0 0