I am wondering, why my point cuts ins Spring AOP do only work, if I specify my beans containing the join points explicitly in the application context XML.
Normally in my project, all Spring beans are defined over annotations:
@Service
@Component
configured with
<context:component-scan base-package="my.package.base" scoped-proxy="interfaces" />
<context:annotation-config />
The beans get created and are usable throughout my application but the point cut is not triggered.
When I specify the bean manually in my application context with
<bean class="..." />
The point cut is matched and the according advice is executed.
@Pointcut("execution(* my.package.base..*.update*(..))")
public void updateDataPointcut() {}
AOP is configured in the application context with
<aop:aspectj-autoproxy />
I have also created a pointcut for Spring Data JPA CrudRepository which works fine.
What is the difference? Is there a pitfall in the "component-scan" configuration?