Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-11364

Incorrect javadoc in SpringServletContainerInitializer

    XMLWordPrintable

Details

    • Task
    • Status: Closed
    • Minor
    • Resolution: Complete
    • 3.2.6, 4.0 GA
    • 3.2.7, 4.0.1
    • Web
    • None

    Description

      The javadoc says

      If a web application includes a WEB-INF/web.xml file, it is important to understand that neither this nor any other ServletContextInitializer will be processed unless the <web-app> element's version attribute is >= "3.0" and the xsi:schemaLocation for "http://java.sun.com/xml/ns/javaee" is set to "http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd".

      but the thread around https://java.net/projects/servlet-spec/lists/users/archive/2012-05/message/1 explicitly states that the version in descriptor doesn't matter, and at least in Tomcat 7.0.50 (and probably since 7.0.29, which has the following in the changelog:

      As per section 1.6.2 of the Servlet 3.0 specification and clarification from the Servlet Expert Group, the servlet specification version declared in web.xml no longer controls if Tomcat scans for annotations. Annotation scanning is now always performed - regardless of the version declared in web.xml - unless metadata complete is set to true.

      ) the initializer is used even with version="2.5" in web.xml.

      Attachments

        Activity

          People

            juergen.hoeller Juergen Hoeller
            mpol MichaƂ Politowski
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              3 years, 38 weeks, 1 day ago