Hi,
I am trying AOP parametrization for the first time. I would really appreciate if somebody could help me clear the following doubt.
I have a advice method around a given Business logic method. Is it possible to add a new parameter to my advice method and pass the value hard coded in the xml configuration?
For example
Here i want my method to take one more parameterCode:<bean id="myAspect" class="com.mypackage.MyAspect" /> <aop:config> <aop:aspect ref="myAspect"> <aop:pointcut id="businessLogic" expression="execution(* com.mypackage.businessLogic(..))" /> <aop:after-returning pointcut-ref="businessLogic" method="doApectWork" returning="myObject" /> </aop:aspect> </aop:config> Apect Method being public void doApectWork(JoinPoint jp, Object myObject)
and pass the same at deploy time through my xml configuration.Code:public void doApectWork(JoinPoint jp, Object myObject, myStaticParam)
Basically, what I am trying to achieve here is that if I have 2 Business Logic methods for the first one I want to apply an aspect with a static parameter and another aspect for the second business logic method with another static parameter and invoke the same method.
I cannot make this into two different methods as the parameter values play a role further in the code.
If this is not possible through aspect, is there any other way I can achieve the same using Spring.
Thanks in advance
Paddy


Reply With Quote
