Cannot resolve property "criticismEngine" error in Spring xml configuration -
i have taken example book on spring , should create instance of aspect "Сriticaspect" of static aspectof() method, "cannot resolve property "criticismengine" error while configuring criticaspect in xml, although there such property in criticaspect class.
xml config file looks like:
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> <context:component-scan base-package="concert"/> <context:load-time-weaver/> <aop:aspectj-autoproxy/> <bean class="concert.audience"/> <bean id="show" class="concert.show" ><aop:scoped-proxy /></bean> <bean id="criticismengine" class="concert.criticismengineimpl"> <property name="criticismpool"> <list> <value>worst performance ever</value> <value>i laughed, cried</value> <value>a must see show!</value> </list> </property> </bean> <bean class="concert.criticaspect" factory-method="aspectof" > <property name="criticismengine" ref="criticismengine" /> </bean> </beans>
aspect criticaspect looks like:
package concert; public aspect criticaspect { private criticismengine criticismengine; public criticaspect(){} pointcut performance() : execution(* perform(..)); after()returning: performance(){ system.out.println(criticismengine.getcriticism()); } public void setcriticismengine(criticismengine criticismengine){ this.criticismengine=criticismengine; } }
like said in my answer similar question same code snippet same book:
i think need decide whether use
- spring aop via
<aop:aspectj-autoproxy/>
or - aspectj via
<context:load-time-weaver/>
,
but not both together. use native aspectj syntax, want use second option. please try , see happens if remove autoproxy statement xml configuration.
please note in order compile native aspectj code, need use aspectj compiler ajc, not javac.
Comments
Post a Comment