0

I am trying to configure my latest Spring application programmatically instead of with an xml file. However, I am running into a problem where when I import the spring-webmvc-4.0.3.RELEASE jar the compiler no longer uses the Servlet 3 api.

I need to have access to methods like: ServletContext.addListener(java.lang.Class listenerClass)

and

ServletContext.addServlet(java.lang.String servletName, java.lang.Class servletClass)

But I also need to be able to use spring mvc classes like DispatcherServlet .

Is this a known bug with Spring 4 and does anyone know of any resolution for it?

Kyle Bauer
  • 83
  • 1
  • 1
  • 9
  • I doubt that that comes from adding the spring-webmvc.jar to your classpath. Spring MVC itself also depends on servlet 3.0 for certain classes (like the `SpringServletContainerInitializer` ) – M. Deinum Apr 11 '14 at 14:02
  • Thats what I have been reading... I have actually managed to fix it by adding the spring-mvc jar directly to the classpath while adding the servlet 3 jar to the lib folder, although it doesnt seem like it should have to be done that way... – Kyle Bauer Apr 11 '14 at 14:21
  • Aren't you using something like maven or gradle to manage your dependencies?! – M. Deinum Apr 11 '14 at 14:23
  • No I have never used them before – Kyle Bauer Apr 11 '14 at 14:30

0 Answers0