Below is the advice and pointcut that I have applied for presentation layer.
Here after advice is working fine but before advice is not working for @ModelAttribute annotated method.Code:@Pointcut("!@annotation(org.springframework.web.bind.annotation.ModelAttribute) && (execution(* com.abcd.cp.presentation..*.*(..)))") private void loggingOperation() {} @Before("loggingOperation()") public void logBefore(JoinPoint joinPoint) { log.info("The Method " + joinPoint.getSignature().getName() + "() in Target Class " + joinPoint.getTarget().getClass().getName() + " Starts execution"); }
I am using 1.6.4 version of AspectJ and 3.1 version of Spring AOP. When getCountryList method is called userService object is null. If I remove before advice then this is working fine.Code:@SuppressWarnings( { "unused" }) @ModelAttribute(COUNTRY_LIST) private List<Country> getCountryList() throws SystemException, PortalException { return userService.getCountryList(); }


Reply With Quote