Hello,
I have a question regarding proxy creation around beans when application context is split across multiple XML files.
What is the order of creating beans from multiple files and creating of proxies?
Are proxies created at the end, when all beans (defined in all xml files) are created in Spring application context?
I am developing a Spring MVC application and I have defined the most of beans in myapp-servlet.xml.
The DAO beans are defined in a separated XML file called database_config.xml, which is included in application context in web.xml file.
I would like to implement logging of the methods in the DAO objects with aspects, but it seems to me that a proxy
can't be wrapped around DAO beans if DAO beans are defined in database_config.xml.
Are DAO beans created in application context after auto proxy creator creates proxies?
When I move DAO beans to myapp-servlet.xml, it works.
I am creating logging advice and auto proxy creator through lines below.
Thank you in advance, and sorry if this issue has already been discussed.Code:<bean id="loggingAdvice" class="mypackage.LoggingAdvice"> </bean> <bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <property name="beanNames"> <value>*Dao</value> </property> <property name="interceptorNames"> <list> <value>loggingAdvice</value> </list> </property> </bean>


Reply With Quote
