Hi,
Deployment environment: Spring 2.0.3 or 2.0.7 and Weblogic 10.0.
I have a Spring xml config file called common-app-context.xml that defines an aspect as follows:
I also have other two other xml configuration files app-context1.xml and app-context2.xml where I import in both the above common-app-context.xml using <import resource="common-app-context.xml"/> . As well, app-context1.xml imports app-context2.xml resource. During container start-up, app-context1.xml is used by a ClasspathXmlApplicationContext to initialize the appContext.Code:<aop:config> <aop:pointcut id="dataAccessOperation" expression="execution(* com.test.dao.*.*(..))"/> <aop:aspect id="timingAspect" ref="timingAdvice"> <aop:around pointcut-ref="dataAccessOperation" method="captureTiming"/> </aop:aspect> </aop:config>
Here's the scheme:
Obviously this isn't exactly correct since app-context1.xml doesn't have to import the resource common-app-context.xml but this is how I found that this way the timingAspect is applied twice at runtime which means that the timingAspect was created twice.Code:app-context2.xml---->common-app-context.xml ^ ^ | | app-context1.xml-------------
My understanding was that at runtime Spring merges all <spring:config> definitions and since I have ID'd my aspect I expected that only one timingAspect is created at runtime.
Is this by design? Please advise.
thanks!
florin


Reply With Quote