The Dispatcher Servlet does it automatically by using the dispatcher-servlet.xml [1]. AFAIK Spring does reference this by re-using the servlet name tag. Everything else is needed to run a Spring MVC application with spring-dm. It is a working sample that is used in a Karaf Integration test, take a look at [2].
regards, Achim [1] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/war-spring-osgi/src/main/webapp/WEB-INF/dispatcher-servlet.xml [2] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/pax-web-itest-karaf/src/test/java/org/ops4j/pax/web/itest/karaf/SpringOsgiKarafTest.java 2014-04-16 6:14 GMT+02:00 asookazian2 <[email protected]>: > We have the following config in our web.xml: > > <servlet> > <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> > > > <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> > <init-param> > <param-name>contextConfigLocation</param-name> > <param-value>/WEB-INF/applicationContext.xml</param-value> > </init-param> > <load-on-startup>1</load-on-startup> > </servlet> > > In the below config, how do you load the applicationContext.xml? > > > https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/war-spring-osgi/src/main/webapp/WEB-INF/web.xml > < > https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/war-spring-osgi/src/main/webapp/WEB-INF/web.xml > > > > <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns="http://java.sun.com/xml/ns/javaee" > xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" > xsi:schemaLocation="http://java.sun.com/xml/ns/javaee > http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" > id="WebApp_ID" version="3.0"> > > <display-name>HelloWorldSpring</display-name> > <welcome-file-list> > <welcome-file>index.jsp</welcome-file> > </welcome-file-list> > > <context-param> > <param-name>contextClass</param-name> > > > <param-value>org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext</param-value> > </context-param> > > <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.osgi.web.context.support.OsgiBundleXmlWebApplicationContext</param-value> > </init-param> > </servlet> > > <servlet-mapping> > <servlet-name>dispatcher</servlet-name> > <url-pattern>*.do</url-pattern> > </servlet-mapping> > > </web-app> > > > > -- > View this message in context: > http://karaf.922171.n3.nabble.com/cannot-resolve-to-absolute-file-path-in-karaf-3-0-0-tp4032407p4032792.html > Sent from the Karaf - User mailing list archive at Nabble.com. > -- Apache Karaf <http://karaf.apache.org/> Committer & PMC OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & Project Lead blog <http://notizblog.nierbeck.de/> Software Architect / Project Manager / Scrum Master
