Skip to content

Commit

Permalink
Update API version and package references for Jakarta EE 9
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed Nov 17, 2021
1 parent 555807e commit b88ed7f
Show file tree
Hide file tree
Showing 45 changed files with 305 additions and 354 deletions.
6 changes: 2 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ configure(allprojects) { project ->
dependencySet(group: 'org.apache.tomcat', version: '10.0.12') {
entry 'tomcat-util'
entry('tomcat-websocket') {
exclude group: "org.apache.tomcat", name: "tomcat-websocket-api"
exclude group: "org.apache.tomcat", name: "tomcat-servlet-api"
exclude group: "org.apache.tomcat", name: "tomcat-websocket-api"
}
}
dependencySet(group: 'org.apache.tomcat.embed', version: '10.0.12') {
Expand All @@ -130,9 +130,7 @@ configure(allprojects) { project ->
}
dependencySet(group: 'io.undertow', version: '2.2.12.Final') {
entry 'undertow-core'
entry('undertow-servlet-jakartaee9') {
exclude group: "org.jboss.spec.javax.annotation", name: "jboss-annotations-api_1.3_spec"
}
entry 'undertow-servlet-jakartaee9'
entry 'undertow-websockets-jsr-jakartaee9'
}

Expand Down
2 changes: 1 addition & 1 deletion spring-aspects/spring-aspects.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies {
optional(project(":spring-orm")) // for JPA exception translation support
optional(project(":spring-tx")) // for JPA, @Transactional support
optional("javax.cache:cache-api") // for JCache aspect
optional("jakarta.transaction:jakarta.transaction-api") // for @javax.transaction.Transactional support
optional("jakarta.transaction:jakarta.transaction-api") // for @jakarta.transaction.Transactional support
testImplementation(project(":spring-core")) // for CodeStyleAspect
testImplementation(project(":spring-test"))
testImplementation(testFixtures(project(":spring-context")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.springframework.util.Assert;

/**
* A {@link ServerHttpAsyncRequestControl} to use on Servlet containers (Servlet 3.0+).
* A {@link ServerHttpAsyncRequestControl} to use on Servlet containers.
*
* @author Rossen Stoyanchev
* @since 4.0
Expand Down Expand Up @@ -62,7 +62,7 @@ public ServletServerHttpAsyncRequestControl(ServletServerHttpRequest request, Se
"Async support must be enabled on a servlet and for all filters involved " +
"in async request processing. This is done in Java code using the Servlet API " +
"or by adding \"<async-supported>true</async-supported>\" to servlet and " +
"filter declarations in web.xml. Also you must use a Servlet 3.0+ container");
"filter declarations in web.xml.");

this.request = request;
this.response = response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* event-listener read APIs and Reactive Streams.
*
* <p>Specifically a base class for reading from the HTTP request body with
* Servlet 3.1 non-blocking I/O and Undertow XNIO as well as handling incoming
* Servlet non-blocking I/O and Undertow XNIO as well as handling incoming
* WebSocket messages with standard Java WebSocket (JSR-356), Jetty, and
* Undertow.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
import org.springframework.http.HttpHeaders;

/**
* Abstract base class for listener-based server responses, e.g. Servlet 3.1
* and Undertow.
* Abstract base class for listener-based server responses.
*
* @author Arjen Poutsma
* @since 5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* event-listener write APIs and Reactive Streams.
*
* <p>Specifically a base class for writing to the HTTP response body with
* Servlet 3.1 non-blocking I/O and Undertow XNIO as well for writing WebSocket
* Servlet non-blocking I/O and Undertow XNIO as well for writing WebSocket
* messages through the Java WebSocket API (JSR-356), Jetty, and Undertow.
*
* @author Arjen Poutsma
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

/**
* Adapt {@link HttpHandler} to an {@link HttpServlet} using Servlet Async support
* and Servlet 3.1 non-blocking I/O.
* and Servlet non-blocking I/O.
*
* @author Arjen Poutsma
* @author Rossen Stoyanchev
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* {@link org.springframework.http.server.reactive.HttpHandler} for processing.
*
* <p>Also provides implementations adapting to different runtimes
* including Servlet 3.1 containers, Netty + Reactor IO, and Undertow.
* including Servlet containers, Netty + Reactor IO, and Undertow.
*/
@NonNullApi
@NonNullFields
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,21 +33,18 @@
import org.springframework.util.ReflectionUtils;

/**
* Servlet 3.0 {@link ServletContainerInitializer} designed to support code-based
* A Spring-provided {@link ServletContainerInitializer} designed to support code-based
* configuration of the servlet container using Spring's {@link WebApplicationInitializer}
* SPI as opposed to (or possibly in combination with) the traditional
* {@code web.xml}-based approach.
*
* <h2>Mechanism of Operation</h2>
* This class will be loaded and instantiated and have its {@link #onStartup}
* method invoked by any Servlet 3.0-compliant container during container startup assuming
* method invoked by any Servlet-compliant container during container startup assuming
* that the {@code spring-web} module JAR is present on the classpath. This occurs through
* the JAR Services API {@link ServiceLoader#load(Class)} method detecting the
* {@code spring-web} module's {@code META-INF/services/jakarta.servlet.ServletContainerInitializer}
* service provider configuration file. See the
* <a href="https://download.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#Service%20Provider">
* JAR Services API documentation</a> as well as section <em>8.2.4</em> of the Servlet 3.0
* Final Draft specification for complete details.
* service provider configuration file.
*
* <h3>In combination with {@code web.xml}</h3>
* A web application can choose to limit the amount of classpath scanning the Servlet
Expand Down Expand Up @@ -80,12 +77,12 @@
* <h2>General Notes</h2>
* In general, this class should be viewed as <em>supporting infrastructure</em> for
* the more important and user-facing {@code WebApplicationInitializer} SPI. Taking
* advantage of this container initializer is also completely <em>optional</em>: while
* it is true that this initializer will be loaded and invoked under all Servlet 3.0+
* runtimes, it remains the user's choice whether to make any
* {@code WebApplicationInitializer} implementations available on the classpath. If no
* {@code WebApplicationInitializer} types are detected, this container initializer will
* have no effect.
* advantage of this container initializer is also completely <em>optional</em>:
* while it is true that this initializer will be loaded and invoked under all
* Servlet runtimes, it remains the user's choice whether to make any
* {@code WebApplicationInitializer} implementations available on the classpath.
* If no {@code WebApplicationInitializer} types are detected, this container
* initializer will have no effect.
*
* <p>Note that use of this container initializer and of {@code WebApplicationInitializer}
* is not in any way "tied" to Spring MVC other than the fact that the types are shipped
Expand Down Expand Up @@ -117,8 +114,8 @@ public class SpringServletContainerInitializer implements ServletContainerInitia
* Delegate the {@code ServletContext} to any {@link WebApplicationInitializer}
* implementations present on the application classpath.
* <p>Because this class declares @{@code HandlesTypes(WebApplicationInitializer.class)},
* Servlet 3.0+ containers will automatically scan the classpath for implementations
* of Spring's {@code WebApplicationInitializer} interface and provide the set of all
* Servlet containers will automatically scan the classpath for implementations of
* Spring's {@code WebApplicationInitializer} interface and provide the set of all
* such types to the {@code webAppInitializerClasses} parameter of this method.
* <p>If no {@code WebApplicationInitializer} implementations are found on the classpath,
* this method is effectively a no-op. An INFO-level log message will be issued notifying
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,13 +20,13 @@
import jakarta.servlet.ServletException;

/**
* Interface to be implemented in Servlet 3.0+ environments in order to configure the
* Interface to be implemented in Servlet environments in order to configure the
* {@link ServletContext} programmatically -- as opposed to (or possibly in conjunction
* with) the traditional {@code web.xml}-based approach.
*
* <p>Implementations of this SPI will be detected automatically by {@link
* SpringServletContainerInitializer}, which itself is bootstrapped automatically
* by any Servlet 3.0 container. See {@linkplain SpringServletContainerInitializer its
* by any Servlet container. See {@linkplain SpringServletContainerInitializer its
* Javadoc} for details on this bootstrapping mechanism.
*
* <h2>Example</h2>
Expand Down Expand Up @@ -74,10 +74,10 @@
* As an alternative to the above, you can also extend from {@link
* org.springframework.web.servlet.support.AbstractDispatcherServletInitializer}.
*
* As you can see, thanks to Servlet 3.0's new {@link ServletContext#addServlet} method
* we're actually registering an <em>instance</em> of the {@code DispatcherServlet}, and
* this means that the {@code DispatcherServlet} can now be treated like any other object
* -- receiving constructor injection of its application context in this case.
* As you can see, thanks to the Servlet container's {@link ServletContext#addServlet}
* method we're actually registering an <em>instance</em> of the {@code DispatcherServlet},
* and this means that the {@code DispatcherServlet} can now be treated like any other
* object -- receiving constructor injection of its application context in this case.
*
* <p>This style is both simpler and more concise. There is no concern for dealing with
* init-params, etc, just normal JavaBean-style properties and constructor arguments. You
Expand All @@ -89,8 +89,8 @@
* {@code ContextLoaderListener} and {@code DelegatingFilterProxy} all now support
* constructor arguments. Even if a component (e.g. non-Spring, other third party) has not
* been specifically updated for use within {@code WebApplicationInitializers}, they still
* may be used in any case. The Servlet 3.0 {@code ServletContext} API allows for setting
* init-params, context-params, etc programmatically.
* may be used in any case. The {@code ServletContext} API allows for setting init-params,
* context-params, etc programmatically.
*
* <h2>A 100% code-based approach to configuration</h2>
* In the example above, {@code WEB-INF/web.xml} was successfully replaced with code in
Expand Down Expand Up @@ -149,24 +149,6 @@
* occurs. Use of this feature is expected to be rare, as typical applications will likely
* centralize all container initialization within a single {@code WebApplicationInitializer}.
*
* <h2>Caveats</h2>
*
* <h3>web.xml versioning</h3>
* <p>{@code WEB-INF/web.xml} and {@code WebApplicationInitializer} use are not mutually
* exclusive; for example, web.xml can register one servlet, and a {@code
* WebApplicationInitializer} can register another. An initializer can even
* <em>modify</em> registrations performed in {@code web.xml} through methods such as
* {@link ServletContext#getServletRegistration(String)}. <strong>However, if
* {@code WEB-INF/web.xml} is present in the application, its {@code version} attribute
* must be set to "3.0" or greater, otherwise {@code ServletContainerInitializer}
* bootstrapping will be ignored by the servlet container.</strong>
*
* <h3>Mapping to '/' under Tomcat</h3>
* <p>Apache Tomcat maps its internal {@code DefaultServlet} to "/", and on Tomcat versions
* &lt;= 7.0.14, this servlet mapping <em>cannot be overridden programmatically</em>.
* 7.0.15 fixes this issue. Overriding the "/" servlet mapping has also been tested
* successfully under GlassFish 3.1.<p>
*
* @author Chris Beams
* @since 3.1
* @see SpringServletContainerInitializer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,7 +35,7 @@
*
* <p>Supported method argument types include {@link MultipartFile} in conjunction with
* Spring's {@link MultipartResolver} abstraction, {@code jakarta.servlet.http.Part} in
* conjunction with Servlet 3.0 multipart requests, or otherwise for any other method
* conjunction with Servlet multipart requests, or otherwise for any other method
* argument, the content of the part is passed through an {@link HttpMessageConverter}
* taking into consideration the 'Content-Type' header of the request part. This is
* analogous to what @{@link RequestBody} does to resolve an argument based on the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
*
* <p>As of Spring 3.1, {@code ContextLoader} supports injecting the root web
* application context via the {@link #ContextLoader(WebApplicationContext)}
* constructor, allowing for programmatic configuration in Servlet 3.0+ environments.
* constructor, allowing for programmatic configuration in Servlet initializers.
* See {@link org.springframework.web.WebApplicationInitializer} for usage examples.
*
* @author Juergen Hoeller
Expand Down Expand Up @@ -193,9 +193,8 @@ public ContextLoader() {

/**
* Create a new {@code ContextLoader} with the given application context. This
* constructor is useful in Servlet 3.0+ environments where instance-based
* registration of listeners is possible through the {@link ServletContext#addListener}
* API.
* constructor is useful in Servlet initializers where instance-based registration
* of listeners is possible through the {@link ServletContext#addListener} API.
* <p>The context may or may not yet be {@linkplain
* ConfigurableApplicationContext#refresh() refreshed}. If it (a) is an implementation
* of {@link ConfigurableWebApplicationContext} and (b) has <strong>not</strong>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,7 @@
*
* <p>As of Spring 3.1, {@code ContextLoaderListener} supports injecting the root web
* application context via the {@link #ContextLoaderListener(WebApplicationContext)}
* constructor, allowing for programmatic configuration in Servlet 3.0+ environments.
* constructor, allowing for programmatic configuration in Servlet initializers.
* See {@link org.springframework.web.WebApplicationInitializer} for usage examples.
*
* @author Juergen Hoeller
Expand Down Expand Up @@ -58,9 +58,8 @@ public ContextLoaderListener() {

/**
* Create a new {@code ContextLoaderListener} with the given application context. This
* constructor is useful in Servlet 3.0+ environments where instance-based
* registration of listeners is possible through the {@link jakarta.servlet.ServletContext#addListener}
* API.
* constructor is useful in Servlet initializers where instance-based registration of
* listeners is possible through the {@link jakarta.servlet.ServletContext#addListener} API.
* <p>The context may or may not yet be {@linkplain
* org.springframework.context.ConfigurableApplicationContext#refresh() refreshed}. If it
* (a) is an implementation of {@link ConfigurableWebApplicationContext} and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.springframework.web.context.request.ServletWebRequest;

/**
* A Servlet 3.0 implementation of {@link AsyncWebRequest}.
* A Servlet implementation of {@link AsyncWebRequest}.
*
* <p>The servlet and all filters involved in an async request must have async
* support enabled using the Servlet API or by adding an
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
* of the {@code Filter.init} and {@code Filter.destroy} lifecycle methods
* on the target bean, letting the servlet container manage the filter lifecycle.
*
* <p>As of Spring 3.1, {@code DelegatingFilterProxy} has been updated to optionally accept
* constructor parameters when using Servlet 3.0's instance-based filter registration
* methods, usually in conjunction with Spring 3.1's
* <p>As of Spring 3.1, {@code DelegatingFilterProxy} has been updated to optionally
* accept constructor parameters when using a Servlet container's instance-based filter
* registration methods, usually in conjunction with Spring's
* {@link org.springframework.web.WebApplicationInitializer} SPI. These constructors allow
* for providing the delegate Filter bean directly, or providing the application context
* and bean name to fetch, avoiding the need to look up the application context from the
Expand Down Expand Up @@ -100,8 +100,7 @@ public class DelegatingFilterProxy extends GenericFilterBean {


/**
* Create a new {@code DelegatingFilterProxy}. For traditional (pre-Servlet 3.0) use
* in {@code web.xml}.
* Create a new {@code DelegatingFilterProxy}. For traditional use in {@code web.xml}.
* @see #setTargetBeanName(String)
*/
public DelegatingFilterProxy() {
Expand All @@ -111,8 +110,7 @@ public DelegatingFilterProxy() {
* Create a new {@code DelegatingFilterProxy} with the given {@link Filter} delegate.
* Bypasses entirely the need for interacting with a Spring application context,
* specifying the {@linkplain #setTargetBeanName target bean name}, etc.
* <p>For use in Servlet 3.0+ environments where instance-based registration of
* filters is supported.
* <p>For use with instance-based registration of filters.
* @param delegate the {@code Filter} instance that this proxy will delegate to and
* manage the lifecycle for (must not be {@code null}).
* @see #doFilter(ServletRequest, ServletResponse, FilterChain)
Expand All @@ -130,9 +128,8 @@ public DelegatingFilterProxy(Filter delegate) {
* bean from the Spring {@code WebApplicationContext} found in the {@code ServletContext}
* (either the 'root' application context or the context named by
* {@link #setContextAttribute}).
* <p>For use in Servlet 3.0+ environments where instance-based registration of
* filters is supported.
* <p>The target bean must implement the standard Servlet Filter.
* <p>For use with instance-based registration of filters.
* <p>The target bean must implement the standard Servlet Filter interface.
* @param targetBeanName name of the target filter bean to look up in the Spring
* application context (must not be {@code null}).
* @see #findWebApplicationContext()
Expand All @@ -145,8 +142,7 @@ public DelegatingFilterProxy(String targetBeanName) {
/**
* Create a new {@code DelegatingFilterProxy} that will retrieve the named target
* bean from the given Spring {@code WebApplicationContext}.
* <p>For use in Servlet 3.0+ environments where instance-based registration of
* filters is supported.
* <p>For use with instance-based registration of filters.
* <p>The target bean must implement the standard Servlet Filter interface.
* <p>The given {@code WebApplicationContext} may or may not be refreshed when passed
* in. If it has not, and if the context implements {@link ConfigurableApplicationContext},
Expand Down
Loading

0 comments on commit b88ed7f

Please sign in to comment.