java - AspectJ get the object which calls the method and its argument -
i have following aspectj definition in spring configuration xml file
<bean id="valuelogging" class="org.beans.valuelogging"> <constructor-arg value="#{t(system).out}" /> </bean> <aop:config> <aop:aspect ref="valuelogging"> <aop:pointcut id="settingvalue" expression="execution(* *.setvalue(..)) , args(parameter, value)"/> <aop:after pointcut-ref="settingvalue" method="logaftersettingavalue" /> </aop:aspect> </aop:config>
then, have valuelogging
class:
public class valuelogging { private printstream stream; public valuelogging(printstream stream) { this.stream = stream; } public void logaftersettingavalue(final object element, final string parameter, final double value) { stream.println(element + " :the value " + value + " has been set parameter " + parameter.getname()); } }
i'm getting initialization error. here part of trace:
org.springframework.beans.factory.beancreationexception: error creating bean name 'networkelement' defined in class path resource [meta-inf/spring/parameterchange.xml]: beanpostprocessor before instantiation of bean failed; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'org.springframework.aop.aspectj.aspectjpointcutadvisor#0': bean instantiation via constructor failed; nested exception org.springframework.beans.beaninstantiationexception: failed instantiate [org.springframework.aop.aspectj.aspectjpointcutadvisor]: constructor threw exception; nested exception java.lang.illegalargumentexception: warning no match type name: [xlint:invalidabsolutetypename] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:472) @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:303) @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230) @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:299) @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:194) @ org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:755) @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:757) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:480) @ org.springframework.context.support.classpathxmlapplicationcontext.(classpathxmlapplicationcontext.java:139) @ org.springframework.context.support.classpathxmlapplicationcontext.(classpathxmlapplicationcontext.java:83) @ com.ericsson.domain.parameterchangemain.main(parameterchangemain.java:16) caused by: org.springframework.beans.factory.beancreationexception: error creating bean nam
i think due fact i'm not able capture caller of method give argument logaftersettingavalue
method. idea?
Comments
Post a Comment