java - Add constructor to AspectJ aspect with parameters -
i have
@aspect public class myaspect { int x,y,z; public myaspect(int _x,int _y,int _z){ x=_x; y=_y; z=_z; } @after("execution(public * save(..))") public void methodafter(joinpoint joinpoint) { //code }
after calling save method,it doesn't execute methodafter. however,without constructor,it works.how can use aspectj constructors?
i assume working in spring environment, suggest you'll is:
- add @component annotation aspect.
- use @inject , @value annotations inject required values x,y,z.
Comments
Post a Comment