Announcement Announcement Module
No announcement yet.
AOP weaving is not working with Spring MVC 3.1.0 and AOP 1.6.9 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • AOP weaving is not working with Spring MVC 3.1.0 and AOP 1.6.9


    Help will be appreciated.

    Here is my Use case and approach.

    1. Need to validate the User before get in to the any method/s.

    For this I created
    1. A annotation class BusinessValidation

    public @interface BusinessValidation {


    2. Created an Aspect class

    public class BusinessAspect {

    @Before("execution(* com.tutorials.spring.aop..*.*(..)) && " +
    "args(id,email,..) && " +
    public void validate(int id, string email){




    3. Controller Class
    public class Controller {

    private XXXFacade facade;

    @RequestMapping(value = "/xxx", method = RequestMethod.GET, produces = "application/json")
    public @ResponseBody ResponseEntity<xxx> getXXX(@RequestParam(value = "id", required = false) int id,
    @RequestParam( value = "email") email, Model model) throws Exception

    // CODE


    4. Config xml -servlet.xml - I have following entries

    <bean id="businessAspect" class="com.tutorials.spring.aop.BusinessAspect"/>

    <aop:aspectj-autoproxy proxy-target-class="true" />

    There is no problem in server start up. Aspect never invoked by calling the getXXX() method in my controller class.
    I m using Java 6 update 24, Spring 3.1.0, AspectJ 1.6.9, Aspectweaver 1.6.9, spring-aop 3.1.0.

    Can you tell me what is the problem?
    Can i use AOP and custom annotation with Spring MVC?