Unable to create ServerOsgiBundleXmlWebApplicationContext
I am creating a war whose context comes from multiple context.xml files. In dm 1, the ServerOsgiBundleXmlWebApplicationContext is configured automatically by files under META-INF/spring. How can I achieve the same effect in dm 2?
I tried
Code:
<web-app ..>
<context-param>
<param-name>contextClass</param-name>
<param-value>com.springsource.server.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/META-INF/spring/context1.xml
/META-INF/spring/context2.xml
</param-value>
</context-param>
<servlet>
<servlet-name>mywebapp</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<!-- mywebapp-context.xml doesn't contain any beans -->
<param-value>
/WEB-INF/mywebapp-context.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
</web-app>
and
Code:
<web-app>
<!-- removed the root context definition -->
<servlet>
<servlet-name>mywebapp</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/META-INF/spring/context1.xml
/META-INF/spring/context2.xml
</param-value>
</init-param>
<init-param>
<param-name>contextClass</param-name>
<param-value>com.springsource.server.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
</web-app>
Both threw BeanDefinition not found exception that a bean defined in context1 is not visible but used by context2.
Any help is appreciated.