Hi, I want to add some logging functionality to the XFire spring example--Echo, that is, after some client invokes the Echo service, I want to log something. I think Spring AOP is the best choice, here is my applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd "> <beans> <bean id="echoBean" class="org.codehaus.xfire.spring.example.EchoImpl"/> <bean id="LoggingInterceptor" class="com.xyz.LoggingAdvice"/> <bean id="LoggingPointcutAdvisor" class=" org.springframework.aop.support.DefaultPointcutAdvisor "> <property name="advice"> <ref local="LoggingInterceptor"/> </property> <property name="pointcut"> <bean class=" org.springframework.aop.support.JdkRegexpMethodPointcut"> <property name="pattern"> <value>.*</value> </property> </bean> </property> </bean> <bean id="LoggingAOPProxy" class=" org.springframework.aop.framework.ProxyFactoryBean"> <property name="target"> <ref local="echoBean" /> </property> <property name="interceptorNames"> <list> <value>LoggingPointcutAdvisor</value> </list> </property> </bean> </beans> the LoggingAdvice mentioned before is simple: package com.xyz; import java.lang.reflect.Method; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.log4j.Logger; import org.springframework.aop.AfterReturningAdvice; import org.springframework.aop.MethodBeforeAdvice ; public class LoggingAdvice implements MethodBeforeAdvice, AfterReturningAdvice { private static Log log = LogFactory.getLog(LoggingAdvice.class); public void before(Method method, Object[] args, Object target) throws Throwable { log.debug("before"); } public void afterReturning(Object retuVal, Method method, Object[] args, Object target) throws Throwable { log.debug("afterReturning"); } } while xfire-servlet.xml is the same as in the example. However the interceptor just does not work, can anyone please help me? thanks.
