Hi all,
Had a doubt regarding the spring AOP or rather AOP in general.
If I have a class having 2 methods - MethodA() and MethodB().
Before advice is applied to MethodA() so that another method(lets say MethodC()) is called before it. This works fine if you instantiate the class through ApplicationContext and call MethodA() on that instance.
Would that method be called if we call methodA() from MethodB() directly(as in, a java method call), considering that MethodB() is called on an instance instantiated through Spring's ApplicationContext??
Its not getting called..
Please clarify whether its correct as per AOP's rules or not.
Regards,
Sumeet
Kalyana Chakravarthy Gade
Greenhorn
Joined: Jan 10, 2008
Posts: 1
posted
0
It will not get called because Spring AOP is proxy-based. Please see this Spring documentation link for more details.
I now have a doubt in the transaction management related to this.
The transaction propagation rules are used for specifying how a method would behave if it is called from another method which is/is not running within a transaction.
Referring to the attachment, I want to implement a scenario where method-A() has "REQUIRED" propagation level and it calls method-B(), which has "NEVER" propagation level, so that it throws an exception.
How to make sure that the transaction advice defined for method-B() (which is specified through AOP code written below) gets executed if it gets called through method-A() as displayed in the figure?