Is it possible to use an Interface (or an Abstract class) in target for aop:aspect.
org.ImyInterface is an Interface.
If I write code as args(myArgument) where myArgument is the name of the single argument that update method accepts, it works.
Instead of hard-wiring to the name of the argument that update method takes, I want to use data type (type of object that myArgument takes).
myArgument will be of type ImyInterface. As such, instead of putting args(myArgument), can I write as target(org.ImyInterface)?
With target(org.ImyInterface) I get following error:
<aop:config>
<aop:aspect ref="myUtil">
<aopointcut
id="myId"
expression="execution(* org.*.update*(..)) and target(org.ImyInterface)"
/>
<aop:around
method="aroundUpdate"
pointcut-ref="myUpdateOperations"
/>
</aop:aspect>
</aop:config>
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'messageSource' defined in class path resource [spring-example.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAd visor#1': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.aop.aspectj.AspectJPointcutAdv isor]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:405)
at java.security.AccessController.doPrivileged(Access Controller.java:219)
I do not have a concrete class that I can use in target that would be inherited by all the objects that will be passed to the update method. If I only have an Interface (and an Abstract class), but no concrete class, what do I need to do to put in expression, so that I do not hard-code the name of the argument?


ointcut
Reply With Quote