Announcement Announcement Module
Collapse
No announcement yet.
Before Advice is not working for @ModelAttribute annotated method Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Before Advice is not working for @ModelAttribute annotated method

    Below is the advice and pointcut that I have applied for presentation layer.

    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");
    	}
    Here after advice is working fine but before advice is not working for @ModelAttribute annotated method.

    Code:
            @SuppressWarnings( { "unused" })
    	@ModelAttribute(COUNTRY_LIST)
    	private List<Country> getCountryList() throws SystemException, PortalException {
    		return userService.getCountryList();
    	}
    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.
Working...
X