Hi everyone. I'm new to Spring and I am currently working on a project that uses AOP. However, my advice seem to not work at all.
Here's the configuration:
and here's the advice:Code:<bean id="logInController" class="springmacs.mvc.login.LoginController" > </bean> <bean id="operationLogAdvice" class="springmacs.aop.OperationLogAdvice"/> <bean id="pointcut.advisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor"> <property name="advice" ref="operationLogAdvice"/> <property name="mappedName" value="onSubmit"/> </bean> <bean id="advice" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="interceptorNames"> <list> <value>logInController</value> <value>pointcut.advisor</value> </list> </property> </bean> </beans>
What's wrong here? Please help me...Code:public class OperationLogAdvice implements AfterReturningAdvice{ public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable { OperationLogService service=new OperationLogService(); OperationLog operationLog=new OperationLog(); OperationLogPK operationLogPK=new OperationLogPK(); operationLogPK.setTime(TimeUtilities.getCurrentDate().toString()); String log=null; User user=(User) args[2]; operationLogPK.setMacsUserId(user.getUsername()); operationLog.setDescription("Logged in."+ " {"+user.getUsername()+"} "); log="\nLogged in."+ " {"+user.getUsername()+"} "; operationLog.setOperationlogPK(operationLogPK); service.insertOperationLog(operationLog); System.out.println(log); } }Thanks!


Thanks!
Reply With Quote