diff --git a/spring-web/src/main/java/org/springframework/web/SpringServletContainerInitializer.java b/spring-web/src/main/java/org/springframework/web/SpringServletContainerInitializer.java index 6a68645ec3a..ed68160b2d3 100644 --- a/spring-web/src/main/java/org/springframework/web/SpringServletContainerInitializer.java +++ b/spring-web/src/main/java/org/springframework/web/SpringServletContainerInitializer.java @@ -52,6 +52,22 @@ import org.springframework.core.annotation.AnnotationAwareOrderComparator; * processed unless the {@code } element's {@code version} attribute is >= "3.0" * and the {@code 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". + *

A web application can choose to limit the amount of classpath scanning the Servlet + * container does at startup either through the metadata-complete attribute in + * {@code web.xml}, which controls scanning for Servlet annotations or through an + * {@code } element also in {@code web.xml}, which controls which + * web fragments (i.e. jars) are allowed to perform a {@code ServletContainerInitializer} + * scan. When using this feature, the Spring's {@link SpringServletContainerInitializer} + * can be enabled by adding "spring_web" to the list of named web fragments in + * {@code web.xml} as follows: + * + *

+ * {@code
+ * 
+ *   some_web_fragment
+ *   spring_web
+ * 
+ * }
* *

Relationship to Spring's {@code WebApplicationInitializer}

* Spring's {@code WebApplicationInitializer} SPI consists of just one method: @@ -91,6 +107,7 @@ import org.springframework.core.annotation.AnnotationAwareOrderComparator; * * @author Chris Beams * @author Juergen Hoeller + * @author Rossen Stoyanchev * @since 3.1 * @see #onStartup(Set, ServletContext) * @see WebApplicationInitializer diff --git a/spring-web/src/main/resources/META-INF/web-fragment.xml b/spring-web/src/main/resources/META-INF/web-fragment.xml new file mode 100644 index 00000000000..d7c28cbccdb --- /dev/null +++ b/spring-web/src/main/resources/META-INF/web-fragment.xml @@ -0,0 +1,9 @@ + + + + spring_web + + \ No newline at end of file