JAMon的介绍请点击这里,本文使用一个cxf-demo完成演示。
cxf-demo代码如下
HelloWorld.java:
@WebService
public interface HelloWorld {
String sayHi1(Person person);
}
HelloWorldImpl.java
@WebService(endpointInterface = "demo.spring.HelloWorld")
public class HelloWorldImpl implements HelloWorld {
@Override
public String sayHi1(Person person) {
System.out.println("sayHi called");
return "Hello " + person.getName();
}
}
开始动手
1、下载JAMon,点击这里
2、把jamon-x.xx.jar丢到Tomcat的lib目录下
3、把jamon.war丢到Tomcat的webapps目录下
4、修改Spring的配置文件beans.xml
<jaxws:endpoint id="helloWorld" address="/HelloWorld">
<jaxws:implementor>
<ref bean="helloWorldImpl" />
</jaxws:implementor>
</jaxws:endpoint>
<bean id="helloWorldImpl" class="demo.spring.HelloWorldImpl" />
<bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<list>
<value>helloWorldImpl</value>
</list>
</property>
<property name="interceptorNames">
<list>
<value>jamonInterceptor</value>
</list>
</property>
</bean>
<bean id="jamonInterceptor" class="org.springframework.aop.interceptor.JamonPerformanceMonitorInterceptor">
</bean>
<aop:config>
<aop:pointcut id="jamonMonitoringPointcut" expression="execution(* demo.spring.HelloWorldImpl.*(..))" />
<aop:advisor pointcut-ref="jamonMonitoringPointcut" advice-ref="jamonInterceptor" />
</aop:config>
访问http://localhost/jamon,进入JAMon Admin Page得出以下结果。