I have recently installed Spring Tool Suite 2.7.1.RELEASE.
I have created a template Spring MVC application and upgraded the Spring dependencies to use 3.1.0.M2. I am currently trying to replace the web.xml with an instance of WebApplicationInitializer. However this class isn't found when running the application using the built in tcServer.
If I build a war using maven and then deploy it to a Tomcat 7 install in C:\Program Files outside of STS the WebApplicationInitializer is found.
Is this a known problem or is there likely to be something which I have missed?
Thanks,
Alex
Here is the WebApplicationInitializer which I am using.
Code:public void onStartup(ServletContext servletContext) throws ServletException { XmlWebApplicationContext rootContext = new XmlWebApplicationContext(); rootContext.setConfigLocation("/WEB-INF/spring/root-context.xml"); servletContext.addListener(new ContextLoaderListener(rootContext)); XmlWebApplicationContext dispatcherContext = new XmlWebApplicationContext(); dispatcherContext .setConfigLocation("/WEB-INF/spring/appServlet/servlet-context.xml"); // Register and map the dispatcher servlet ServletRegistration.Dynamic dispatcher = servletContext.addServlet( "dispatcher", new DispatcherServlet(dispatcherContext)); dispatcher.setLoadOnStartup(1); dispatcher.addMapping("/"); }


Reply With Quote
