I try to use spring weblogic LTW in my project to do some aop stuff. my project is a simple webapp servlet2.5 use spring mvc 3.2.6, running on weblogic 10.0. I have following app level configuration setup in web.xml
@Configuration @EnableLoadTimeWeaving public class AppConfig { } @Configuration @EnableTransactionManagement @ComponentScan(basePackages = { "com.blabla.model" }) public class CoreConfig { }
I also have a mvc level configuration setup in my web.xml
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = { "com.blabla.controller" })
public class MVCConfig extends WebMvcConfigurerAdapter {
}
here is my simplified web.xml
<context-param>
<param-name>contextClass</param-name>
<param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext
</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>AppConfig,CoreConfig
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>contextClass</param-name>
<param-value>
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
</param-value>
</init-param>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>MVCConfig
</param-value>
</init-param>
<init-param>
<param-name>wl-dispatch-policy</param-name>
<param-value>RestWorkManager</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
so what happens is, MVCConfig
and its scanned components are all woven by LTW and works great. but CoreConfig
and its scanned components (all the DAO) are not picked up by LTW.
I guess that the CoreConfig
and AppConfig
is in the same level, so when AppConfig
and CoreConfig
are loaded, the LTW is not triggered yet.
And I tried to put the CoreConfig
in the same level as MVCConfig
, it got picked up by LTW.
but CoreConfig
is supposed to be application level, not dispatchservlet level. Since many spring web MVC applications use a root context and a child for the DispatcherServlet.
so My question is if I put CoreConfig
in the app level, how to make LTW pick it up? Thanks.