Hello AOP forum:
I got the basic mechanics of AOP working, using a very useful article at http://javaboutique.internet.com/tutorials/ehcache/
and my config is:
<aop:config>
<aopointcut id="processAddProgramPointcut" expression="execution(* *..ProgramMgrImp.processAddProgram(..))" />
<aop:advisor id="methodTimingAdvisor" advice-ref="methodTimingAdvice" pointcut-ref="processAddProgramPointcut" />
</aop:config>
<bean id="methodTimingAdvice" class="gov.nih.nci.rtips.biz.aop.TimingLoggingInte rceptor" />
The problem is that when I want to put some useful code in my advice which uses another bean in our project, like so...
<bean id="methodTimingAdvice" class="gov.nih.nci.rtips.biz.aop.TimingLoggingInte rceptor">
<property name="programMgr"><ref bean="programMgr"/></property>
</bean>
... Tomcat now throws an exception:
================================================== =====
ERROR [ContextLoader.java : 205] Context initialization failed
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'dataMgrTarget' defined in ServletContext resource [/WEB-INF/rtipsContext
.xml]: Cannot resolve reference to bean 'programMgr' while setting bean property 'programMgr'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'programMgr' defined in ServletContext resource [/WEB-INF/rtipsContext.xml]: Cannot resolve reference to bean 'programMgrTarget' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'methodTimingAdvice' defined in ServletContext resource [/WEB-INF/rtipsContext.xml]:
Cannot resolve reference to bean 'programMgr' while setting bean property 'programMgr'; nested exception is org.springframework.beans.factory.BeanCurrentlyInC reationException: Error creating bean with name 'programMgr': org.springframework.beans.factory.FactoryBeanNotIn itializedException: FactoryBean is not fully initialized yet
at org.springframework.beans.factory.support.BeanDefi nitionValueResolver
.resolveReference(BeanDefinitionValueResolver.java :253) [spring.jar:2.0.2]
at org.springframework.beans.factory.support.BeanDefi nitionValueResolver
.resolveValueIfNecessary(BeanDefinitionValueResolv er.java:124) [spring.jar:2.0.2]
at org.springframework.beans.factory.support.Abstract AutowireCapableBean
Factory.applyPropertyValues(AbstractAutowireCapabl eBeanFactory.java:1019) [spring.jar:2.0.2]
at org.springframework.beans.factory.support.Abstract AutowireCapableBean
================================================== ====
Viewing FactoryBeanNotInitializedException on SpringSource (http://static.springsource.org/sprin...Exception.html), it says something about circular references/beans being accessed before being fully initialized.
Has anyone encountered this, or can you point me in a direction?
Thank you in advance.
--Harvey


ointcut id="processAddProgramPointcut" expression="execution(* *..ProgramMgrImp.processAddProgram(..))" />
Reply With Quote
