Advice not getting called in Spring-AOP

Viewed 5214

I have declared the following Aspect which advices a dao call, I'm trying to run @Before advice but its not working.

Here goes the aspect.

package com.hedgebenefits.aop;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
@Aspect
public class AccessControlAspect {
    @Before("within(com.hedgebenefits.daos..*) && execution(public * *(..))")
    public void daoCall() {
        System.out.println("Before advice invoked for DAO method called ");
    }
}

My application-context.xml has the following tag

<aop:aspectj-autoproxy/>

My Dao class is as follows:

package com.hedgebenefits.daos.impl;

import com.hedgebenefits.daos.AdminDao;
import com.hedgebenefits.domain.Admin;
import org.springframework.stereotype.Repository;

@Repository
public class AdminDaoImpl implements AdminDao{
    @Override
    public void save(Admin admin) {
    }
}

I put a breakpoint but I can see that its not active, I'm definitely doing some silly mistake here but can't figure out. Pl. advice.

1 Answers
Related