The other alternative is to use AspectJ and @Configurable. Spring seems to be going towards these days (favoring).
The other alternative is to use AspectJ and @Configurable. Spring seems to be going towards these days (favoring). I would look into it if you are using Spring 3 as it is faster (performance) and more flexible than proxy based aop.
Both methods are inside the same proxy, whereas the AOP functionality just enriches calls from the outside (see Understanding AOP Proxies). There are three ways for you to deal with that restriction: Change your design (that's what I would recommend) Change proxy type from JDK-proxy to proxy-target-class (CGLib-based subclassing) Nope, that doesn't help, see @axtavt's comment, it would have to be static AspectJ compilation. Use ((Service)AopContext.currentProxy()).
Method1() (Works, but is an awful violation of AOP, see the end of Understanding AOP Proxies).
So I should change my design. Just because Spring can't do this? – Premraj Feb 23 at 13:09 @Premraj That's not a question of can't.It doesn't do it, by design.
AOP comes from the outside, and method calls within one object must never depend on it. Also, Spring didn't invent the JDK proxy mechanism. Blame Sun, if you want – Sean Patrick Floyd Feb 23 at 13:14 @Sean-Patrick-Floyd :) – Premraj Feb 23 at 13:22 @Sean Patrick Floyd He can do this if he drops proxy based AOP and uses AspectJ.
So I don't know if its by design but rather a limitation of proxy aop. – Adam Gent Feb 23 at 13:24 1 @Premraj M: to defend Spring framework, EJB 3 suffers the same issue. But what is considered a bad decurrentProxy()) is a standard and advised approach in EJB (getBusinessObject()) – Tomasz Nurkiewicz Feb 23 at 14:44.
You could make your ServiceImpl class implement the BeanFactoryAware interface, and lookup itself thanks to the provided bean factory. But this is not dependency injection anymore. The best solution is to put method1 in another service bean, which would be injected in your existing service bean and to which your existing service bean would delegate.
Both methods are inside the same proxy, whereas the AOP functionality just enriches calls from the outside (see Understanding AOP Proxies). There are three ways for you to deal with that restriction.
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.