Hi all,
I am new to Spring aop and I decided to use aop to track my Struts2 Action class execution time. I have done the following things. But while running the application setter method of the action class is not called.
Here is my code.
xml configuration:
Aspect:Code:<aop:aspectj-autoproxy/> <bean id="myAspect" class="abc.xyz.ActionClassAspect"/> <aop:config> <aop:pointcut id="actionClassPointcut" expression="execution(public * abc.xyz.action.*.*(..)) and !execution(public * abc.xyz.action.*Action.get*(..)) and !execution(public * abc.xyz.action.*Action.set*(..))"/> <aop:around pointcut-ref="actionClassPointcut" method="doActionClassProfilling"/> </aop:aspect> </aop:config>
Action Class:Code:public Object doActionClassProfilling(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { long start = System.currentTimeMillis(); Object returnValue = proceedingJoinPoint.proceed(proceedingJoinPoint.getArgs()); long end = System.currentTimeMillis(); System.out.println(proceedingJoinPoint.getClass()+" TIME: "+(end-start)); return returnValue; }
Thanks in advance.Code:private String userID, password; @Override public String execute() throws Exception { try { LoginService loginService = LoginService.getInstance();; UserProfile userProfile = loginService.validateUser(userID, password); Map<String, Object> sessionMap = ActionContext.getContext().getSession(); sessionMap.put("USER_PROFILE", userProfile); return SUCCESS; } catch(Exception e) { return ERROR; } } public String getUserID() { return userID; } public void setUserID(String userID) { this.userID = userID; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; }


,
Reply With Quote
