连接到实例使用JMX管理工具,可以使用自带的JDK的安装。IDE中的断点可以设置在单元测试或thread.sleep可以增加暂停应用程序关闭。激活局部JMX访问,java的说法-dcom.sun.management.jmxremote测试开始时必须使用。
背景:部分扫描创建从servermanagerimpl弹簧豆。
http://docs.spring.io/spring/docs/4.1.x/spring-framework-reference/html/jmx.html
配置文件
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa-1.0.xsd">
<bean id="mBeanExporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="assembler" ref="assembler" />
<property name="namingStrategy" ref="namingStrategy" />
<property name="server">
<bean class="javax.management.MBeanServerFactory" factory-method="createMBeanServer"></bean>
</property>
<property name="autodetect" value="true"/>
</bean>
<bean id="assembler" class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler">
<property name="attributeSource" ref="jmxas" />
</bean>
<bean id="namingStrategy" class="org.springframework.jmx.export.naming.MetadataNamingStrategy">
<property name="attributeSource" ref="jmxas" />
</bean>
<bean id="jmxas" class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource" />
<bean id="htmlAdaptorServer" class="com.sun.jdmk.comm.HtmlAdaptorServer" init-method="start">
<constructor-arg index="0" value="" />
<constructor-arg index="1" ref="authInfo" />
</bean>
<bean id="authInfo" class="com.sun.jdmk.comm.AuthInfo" >
<property name="login" value="" />
<property name="password" value="" />
</bean>
很简单的可以看下官网,