Skip to content

Incorrect javadoc in SpringServletContainerInitializer [SPR-11364] #15990

Closed
@spring-projects-issues

Description

@spring-projects-issues

Michał Politowski opened SPR-11364 and commented

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.


Affects: 3.2.6, 4.0 GA

Reference URL: https://java.net/projects/servlet-spec/lists/users/archive/2012-05/message/1

Backported to: 3.2.7

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchestype: taskA general task

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions