java - Spring - AspectJ pointcut for constructor object with annotation - Stack Overflow
Sotirios Delimanolis is right insofar as Spring AOP does not support constructor interception, you do need full AspectJ for it. The Spring manual, chapter 9.8 Using AspectJ with Spring applications, describes how to use it with LTW (load-time weaving).
Furthermore, there is a problem with your pointcut
@Before("execution(* *.new(..))")
Constructors do not have return types like methods in AspectJ syntax, so you need to remove the leading *
:
@Before("execution(*.new(..))")
Read full article from java - Spring - AspectJ pointcut for constructor object with annotation - Stack Overflow
No comments:
Post a Comment