一、 pom.xml
<dependency>二、 web.xml
<groupId>net.bull.javamelody</groupId>
<artifactId>javamelody-core</artifactId>
<version>1.47.0</version>
</dependency>
<dependency>
<groupId>org.jrobin</groupId>
<artifactId>jrobin</artifactId>
<version>1.5.9</version>
</dependency>
<filter>三、新增spring配置文件 trade-monitoring.xml
<filter-name>monitoring</filter-name>
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
<init-param>
<param-name>log</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>monitoring</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>net.bull.javamelody.SessionListener</listener-class>
</listener>
<?xml version="1.0" encoding="UTF-8"?>四、修改 application-context.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<bean id="springDataSourceBeanPostProcessor" class="net.bull.javamelody.SpringDataSourceBeanPostProcessor">
<!--
<property name="excludedDatasources">
<set>
<value>excludedDataSourceName</value>
</set>
</property>
-->
</bean>
<bean id="wrappedDataSource" class="net.bull.javamelody.SpringDataSourceFactoryBean">
<property name="targetName" value="datasource" /> -- 数据源
</bean>
</beans>
<
import
resource=
"classpath:spring/trade-monitoring.xml"
/>
<import resource="classpath:net/bull/javamelody/monitoring-spring.xml"/>
<bean id="monitoringAdvisor" class="net.bull.javamelody.MonitoringSpringAdvisor">
<property name="pointcut">
<bean class="net.bull.javamelody.MonitoredWithAnnotationPointcut"/>
</property>
</bean>