Spring AOP pointcut definition for string setter?

Since you are using proxy-based AOP, the advice will apply only to Spring beans and the "period" object isn't a bean. You need to either have "period" as a bean or use AspectJ's weaving based AOP. In either case, you will also need to use an around advice instead of before.

Yes thanks, you have right with proxy based aop, but I thought that spring is doing that reflectively also with non spring beans. Anyway I gonna switch to aspectj weaving. But why should I use an around advise instead of before?

– eglobetrotter Nov 30 '10 at 8:33 1 A before advice will add extra logic before the advised join point, but will then continue with the same context (i.e. Original argument to the advised method). With an around advice, you can call proceed() with altered context (in your case, null instead of empty string).

– ramnivas Dec 1 '10 at 0:09.

This design is very tricky and error-prone with Spring JDK proxy based AOP. I've mentionned this point here: yetanotherjavablog.wordpress.com/2011/08... Basically, an aspect define with Spring AOP is implemented at runtime as a proxy object wrapping around the original target. In the bean lifecycle, Spring will create proxies only after the bean is fully initialized, e.g. After all properties injection by setter.

So the first time your setter is called, it will not be intercepted by the advice because the proxy does not exist yet. However all subsequent calls to the setter will be intercepted. Furthermore, be careful about self-invocation issues, e.g. Calling the setter() inside another target method.

It works for me fine with aspectj instrumentation at compile time. – eglobetrotter Aug 11 at 11:33.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions