Skip to content

Commit b88ed7f

Browse files
committed
Update API version and package references for Jakarta EE 9
Closes gh-27689 See gh-25354
1 parent 555807e commit b88ed7f

File tree

45 files changed

+305
-354
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+305
-354
lines changed

build.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ configure(allprojects) { project ->
120120
dependencySet(group: 'org.apache.tomcat', version: '10.0.12') {
121121
entry 'tomcat-util'
122122
entry('tomcat-websocket') {
123-
exclude group: "org.apache.tomcat", name: "tomcat-websocket-api"
124123
exclude group: "org.apache.tomcat", name: "tomcat-servlet-api"
124+
exclude group: "org.apache.tomcat", name: "tomcat-websocket-api"
125125
}
126126
}
127127
dependencySet(group: 'org.apache.tomcat.embed', version: '10.0.12') {
@@ -130,9 +130,7 @@ configure(allprojects) { project ->
130130
}
131131
dependencySet(group: 'io.undertow', version: '2.2.12.Final') {
132132
entry 'undertow-core'
133-
entry('undertow-servlet-jakartaee9') {
134-
exclude group: "org.jboss.spec.javax.annotation", name: "jboss-annotations-api_1.3_spec"
135-
}
133+
entry 'undertow-servlet-jakartaee9'
136134
entry 'undertow-websockets-jsr-jakartaee9'
137135
}
138136

spring-aspects/spring-aspects.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dependencies {
2929
optional(project(":spring-orm")) // for JPA exception translation support
3030
optional(project(":spring-tx")) // for JPA, @Transactional support
3131
optional("javax.cache:cache-api") // for JCache aspect
32-
optional("jakarta.transaction:jakarta.transaction-api") // for @javax.transaction.Transactional support
32+
optional("jakarta.transaction:jakarta.transaction-api") // for @jakarta.transaction.Transactional support
3333
testImplementation(project(":spring-core")) // for CodeStyleAspect
3434
testImplementation(project(":spring-test"))
3535
testImplementation(testFixtures(project(":spring-context")))

spring-web/src/main/java/org/springframework/http/server/ServletServerHttpAsyncRequestControl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import org.springframework.util.Assert;
3030

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

6767
this.request = request;
6868
this.response = response;

spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerReadPublisher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* event-listener read APIs and Reactive Streams.
3636
*
3737
* <p>Specifically a base class for reading from the HTTP request body with
38-
* Servlet 3.1 non-blocking I/O and Undertow XNIO as well as handling incoming
38+
* Servlet non-blocking I/O and Undertow XNIO as well as handling incoming
3939
* WebSocket messages with standard Java WebSocket (JSR-356), Jetty, and
4040
* Undertow.
4141
*

spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerServerHttpResponse.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
import org.springframework.http.HttpHeaders;
2828

2929
/**
30-
* Abstract base class for listener-based server responses, e.g. Servlet 3.1
31-
* and Undertow.
30+
* Abstract base class for listener-based server responses.
3231
*
3332
* @author Arjen Poutsma
3433
* @since 5.0

spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* event-listener write APIs and Reactive Streams.
3535
*
3636
* <p>Specifically a base class for writing to the HTTP response body with
37-
* Servlet 3.1 non-blocking I/O and Undertow XNIO as well for writing WebSocket
37+
* Servlet non-blocking I/O and Undertow XNIO as well for writing WebSocket
3838
* messages through the Java WebSocket API (JSR-356), Jetty, and Undertow.
3939
*
4040
* @author Arjen Poutsma

spring-web/src/main/java/org/springframework/http/server/reactive/ServletHttpHandlerAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
/**
4949
* Adapt {@link HttpHandler} to an {@link HttpServlet} using Servlet Async support
50-
* and Servlet 3.1 non-blocking I/O.
50+
* and Servlet non-blocking I/O.
5151
*
5252
* @author Arjen Poutsma
5353
* @author Rossen Stoyanchev

spring-web/src/main/java/org/springframework/http/server/reactive/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* {@link org.springframework.http.server.reactive.HttpHandler} for processing.
66
*
77
* <p>Also provides implementations adapting to different runtimes
8-
* including Servlet 3.1 containers, Netty + Reactor IO, and Undertow.
8+
* including Servlet containers, Netty + Reactor IO, and Undertow.
99
*/
1010
@NonNullApi
1111
@NonNullFields

spring-web/src/main/java/org/springframework/web/SpringServletContainerInitializer.java

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,21 +33,18 @@
3333
import org.springframework.util.ReflectionUtils;
3434

3535
/**
36-
* Servlet 3.0 {@link ServletContainerInitializer} designed to support code-based
36+
* A Spring-provided {@link ServletContainerInitializer} designed to support code-based
3737
* configuration of the servlet container using Spring's {@link WebApplicationInitializer}
3838
* SPI as opposed to (or possibly in combination with) the traditional
3939
* {@code web.xml}-based approach.
4040
*
4141
* <h2>Mechanism of Operation</h2>
4242
* This class will be loaded and instantiated and have its {@link #onStartup}
43-
* method invoked by any Servlet 3.0-compliant container during container startup assuming
43+
* method invoked by any Servlet-compliant container during container startup assuming
4444
* that the {@code spring-web} module JAR is present on the classpath. This occurs through
4545
* the JAR Services API {@link ServiceLoader#load(Class)} method detecting the
4646
* {@code spring-web} module's {@code META-INF/services/jakarta.servlet.ServletContainerInitializer}
47-
* service provider configuration file. See the
48-
* <a href="https://download.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#Service%20Provider">
49-
* JAR Services API documentation</a> as well as section <em>8.2.4</em> of the Servlet 3.0
50-
* Final Draft specification for complete details.
47+
* service provider configuration file.
5148
*
5249
* <h3>In combination with {@code web.xml}</h3>
5350
* A web application can choose to limit the amount of classpath scanning the Servlet
@@ -80,12 +77,12 @@
8077
* <h2>General Notes</h2>
8178
* In general, this class should be viewed as <em>supporting infrastructure</em> for
8279
* the more important and user-facing {@code WebApplicationInitializer} SPI. Taking
83-
* advantage of this container initializer is also completely <em>optional</em>: while
84-
* it is true that this initializer will be loaded and invoked under all Servlet 3.0+
85-
* runtimes, it remains the user's choice whether to make any
86-
* {@code WebApplicationInitializer} implementations available on the classpath. If no
87-
* {@code WebApplicationInitializer} types are detected, this container initializer will
88-
* have no effect.
80+
* advantage of this container initializer is also completely <em>optional</em>:
81+
* while it is true that this initializer will be loaded and invoked under all
82+
* Servlet runtimes, it remains the user's choice whether to make any
83+
* {@code WebApplicationInitializer} implementations available on the classpath.
84+
* If no {@code WebApplicationInitializer} types are detected, this container
85+
* initializer will have no effect.
8986
*
9087
* <p>Note that use of this container initializer and of {@code WebApplicationInitializer}
9188
* is not in any way "tied" to Spring MVC other than the fact that the types are shipped
@@ -117,8 +114,8 @@ public class SpringServletContainerInitializer implements ServletContainerInitia
117114
* Delegate the {@code ServletContext} to any {@link WebApplicationInitializer}
118115
* implementations present on the application classpath.
119116
* <p>Because this class declares @{@code HandlesTypes(WebApplicationInitializer.class)},
120-
* Servlet 3.0+ containers will automatically scan the classpath for implementations
121-
* of Spring's {@code WebApplicationInitializer} interface and provide the set of all
117+
* Servlet containers will automatically scan the classpath for implementations of
118+
* Spring's {@code WebApplicationInitializer} interface and provide the set of all
122119
* such types to the {@code webAppInitializerClasses} parameter of this method.
123120
* <p>If no {@code WebApplicationInitializer} implementations are found on the classpath,
124121
* this method is effectively a no-op. An INFO-level log message will be issued notifying

spring-web/src/main/java/org/springframework/web/WebApplicationInitializer.java

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,13 +20,13 @@
2020
import jakarta.servlet.ServletException;
2121

2222
/**
23-
* Interface to be implemented in Servlet 3.0+ environments in order to configure the
23+
* Interface to be implemented in Servlet environments in order to configure the
2424
* {@link ServletContext} programmatically -- as opposed to (or possibly in conjunction
2525
* with) the traditional {@code web.xml}-based approach.
2626
*
2727
* <p>Implementations of this SPI will be detected automatically by {@link
2828
* SpringServletContainerInitializer}, which itself is bootstrapped automatically
29-
* by any Servlet 3.0 container. See {@linkplain SpringServletContainerInitializer its
29+
* by any Servlet container. See {@linkplain SpringServletContainerInitializer its
3030
* Javadoc} for details on this bootstrapping mechanism.
3131
*
3232
* <h2>Example</h2>
@@ -74,10 +74,10 @@
7474
* As an alternative to the above, you can also extend from {@link
7575
* org.springframework.web.servlet.support.AbstractDispatcherServletInitializer}.
7676
*
77-
* As you can see, thanks to Servlet 3.0's new {@link ServletContext#addServlet} method
78-
* we're actually registering an <em>instance</em> of the {@code DispatcherServlet}, and
79-
* this means that the {@code DispatcherServlet} can now be treated like any other object
80-
* -- receiving constructor injection of its application context in this case.
77+
* As you can see, thanks to the Servlet container's {@link ServletContext#addServlet}
78+
* method we're actually registering an <em>instance</em> of the {@code DispatcherServlet},
79+
* and this means that the {@code DispatcherServlet} can now be treated like any other
80+
* object -- receiving constructor injection of its application context in this case.
8181
*
8282
* <p>This style is both simpler and more concise. There is no concern for dealing with
8383
* init-params, etc, just normal JavaBean-style properties and constructor arguments. You
@@ -89,8 +89,8 @@
8989
* {@code ContextLoaderListener} and {@code DelegatingFilterProxy} all now support
9090
* constructor arguments. Even if a component (e.g. non-Spring, other third party) has not
9191
* been specifically updated for use within {@code WebApplicationInitializers}, they still
92-
* may be used in any case. The Servlet 3.0 {@code ServletContext} API allows for setting
93-
* init-params, context-params, etc programmatically.
92+
* may be used in any case. The {@code ServletContext} API allows for setting init-params,
93+
* context-params, etc programmatically.
9494
*
9595
* <h2>A 100% code-based approach to configuration</h2>
9696
* In the example above, {@code WEB-INF/web.xml} was successfully replaced with code in
@@ -149,24 +149,6 @@
149149
* occurs. Use of this feature is expected to be rare, as typical applications will likely
150150
* centralize all container initialization within a single {@code WebApplicationInitializer}.
151151
*
152-
* <h2>Caveats</h2>
153-
*
154-
* <h3>web.xml versioning</h3>
155-
* <p>{@code WEB-INF/web.xml} and {@code WebApplicationInitializer} use are not mutually
156-
* exclusive; for example, web.xml can register one servlet, and a {@code
157-
* WebApplicationInitializer} can register another. An initializer can even
158-
* <em>modify</em> registrations performed in {@code web.xml} through methods such as
159-
* {@link ServletContext#getServletRegistration(String)}. <strong>However, if
160-
* {@code WEB-INF/web.xml} is present in the application, its {@code version} attribute
161-
* must be set to "3.0" or greater, otherwise {@code ServletContainerInitializer}
162-
* bootstrapping will be ignored by the servlet container.</strong>
163-
*
164-
* <h3>Mapping to '/' under Tomcat</h3>
165-
* <p>Apache Tomcat maps its internal {@code DefaultServlet} to "/", and on Tomcat versions
166-
* &lt;= 7.0.14, this servlet mapping <em>cannot be overridden programmatically</em>.
167-
* 7.0.15 fixes this issue. Overriding the "/" servlet mapping has also been tested
168-
* successfully under GlassFish 3.1.<p>
169-
*
170152
* @author Chris Beams
171153
* @since 3.1
172154
* @see SpringServletContainerInitializer

spring-web/src/main/java/org/springframework/web/bind/annotation/RequestPart.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
3535
*
3636
* <p>Supported method argument types include {@link MultipartFile} in conjunction with
3737
* Spring's {@link MultipartResolver} abstraction, {@code jakarta.servlet.http.Part} in
38-
* conjunction with Servlet 3.0 multipart requests, or otherwise for any other method
38+
* conjunction with Servlet multipart requests, or otherwise for any other method
3939
* argument, the content of the part is passed through an {@link HttpMessageConverter}
4040
* taking into consideration the 'Content-Type' header of the request part. This is
4141
* analogous to what @{@link RequestBody} does to resolve an argument based on the

spring-web/src/main/java/org/springframework/web/context/ContextLoader.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
*
7373
* <p>As of Spring 3.1, {@code ContextLoader} supports injecting the root web
7474
* application context via the {@link #ContextLoader(WebApplicationContext)}
75-
* constructor, allowing for programmatic configuration in Servlet 3.0+ environments.
75+
* constructor, allowing for programmatic configuration in Servlet initializers.
7676
* See {@link org.springframework.web.WebApplicationInitializer} for usage examples.
7777
*
7878
* @author Juergen Hoeller
@@ -193,9 +193,8 @@ public ContextLoader() {
193193

194194
/**
195195
* Create a new {@code ContextLoader} with the given application context. This
196-
* constructor is useful in Servlet 3.0+ environments where instance-based
197-
* registration of listeners is possible through the {@link ServletContext#addListener}
198-
* API.
196+
* constructor is useful in Servlet initializers where instance-based registration
197+
* of listeners is possible through the {@link ServletContext#addListener} API.
199198
* <p>The context may or may not yet be {@linkplain
200199
* ConfigurableApplicationContext#refresh() refreshed}. If it (a) is an implementation
201200
* of {@link ConfigurableWebApplicationContext} and (b) has <strong>not</strong>

spring-web/src/main/java/org/springframework/web/context/ContextLoaderListener.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
2525
*
2626
* <p>As of Spring 3.1, {@code ContextLoaderListener} supports injecting the root web
2727
* application context via the {@link #ContextLoaderListener(WebApplicationContext)}
28-
* constructor, allowing for programmatic configuration in Servlet 3.0+ environments.
28+
* constructor, allowing for programmatic configuration in Servlet initializers.
2929
* See {@link org.springframework.web.WebApplicationInitializer} for usage examples.
3030
*
3131
* @author Juergen Hoeller
@@ -58,9 +58,8 @@ public ContextLoaderListener() {
5858

5959
/**
6060
* Create a new {@code ContextLoaderListener} with the given application context. This
61-
* constructor is useful in Servlet 3.0+ environments where instance-based
62-
* registration of listeners is possible through the {@link jakarta.servlet.ServletContext#addListener}
63-
* API.
61+
* constructor is useful in Servlet initializers where instance-based registration of
62+
* listeners is possible through the {@link jakarta.servlet.ServletContext#addListener} API.
6463
* <p>The context may or may not yet be {@linkplain
6564
* org.springframework.context.ConfigurableApplicationContext#refresh() refreshed}. If it
6665
* (a) is an implementation of {@link ConfigurableWebApplicationContext} and

spring-web/src/main/java/org/springframework/web/context/request/async/StandardServletAsyncWebRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import org.springframework.web.context.request.ServletWebRequest;
3333

3434
/**
35-
* A Servlet 3.0 implementation of {@link AsyncWebRequest}.
35+
* A Servlet implementation of {@link AsyncWebRequest}.
3636
*
3737
* <p>The servlet and all filters involved in an async request must have async
3838
* support enabled using the Servlet API or by adding an

spring-web/src/main/java/org/springframework/web/filter/DelegatingFilterProxy.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@
5454
* of the {@code Filter.init} and {@code Filter.destroy} lifecycle methods
5555
* on the target bean, letting the servlet container manage the filter lifecycle.
5656
*
57-
* <p>As of Spring 3.1, {@code DelegatingFilterProxy} has been updated to optionally accept
58-
* constructor parameters when using Servlet 3.0's instance-based filter registration
59-
* methods, usually in conjunction with Spring 3.1's
57+
* <p>As of Spring 3.1, {@code DelegatingFilterProxy} has been updated to optionally
58+
* accept constructor parameters when using a Servlet container's instance-based filter
59+
* registration methods, usually in conjunction with Spring's
6060
* {@link org.springframework.web.WebApplicationInitializer} SPI. These constructors allow
6161
* for providing the delegate Filter bean directly, or providing the application context
6262
* and bean name to fetch, avoiding the need to look up the application context from the
@@ -100,8 +100,7 @@ public class DelegatingFilterProxy extends GenericFilterBean {
100100

101101

102102
/**
103-
* Create a new {@code DelegatingFilterProxy}. For traditional (pre-Servlet 3.0) use
104-
* in {@code web.xml}.
103+
* Create a new {@code DelegatingFilterProxy}. For traditional use in {@code web.xml}.
105104
* @see #setTargetBeanName(String)
106105
*/
107106
public DelegatingFilterProxy() {
@@ -111,8 +110,7 @@ public DelegatingFilterProxy() {
111110
* Create a new {@code DelegatingFilterProxy} with the given {@link Filter} delegate.
112111
* Bypasses entirely the need for interacting with a Spring application context,
113112
* specifying the {@linkplain #setTargetBeanName target bean name}, etc.
114-
* <p>For use in Servlet 3.0+ environments where instance-based registration of
115-
* filters is supported.
113+
* <p>For use with instance-based registration of filters.
116114
* @param delegate the {@code Filter} instance that this proxy will delegate to and
117115
* manage the lifecycle for (must not be {@code null}).
118116
* @see #doFilter(ServletRequest, ServletResponse, FilterChain)
@@ -130,9 +128,8 @@ public DelegatingFilterProxy(Filter delegate) {
130128
* bean from the Spring {@code WebApplicationContext} found in the {@code ServletContext}
131129
* (either the 'root' application context or the context named by
132130
* {@link #setContextAttribute}).
133-
* <p>For use in Servlet 3.0+ environments where instance-based registration of
134-
* filters is supported.
135-
* <p>The target bean must implement the standard Servlet Filter.
131+
* <p>For use with instance-based registration of filters.
132+
* <p>The target bean must implement the standard Servlet Filter interface.
136133
* @param targetBeanName name of the target filter bean to look up in the Spring
137134
* application context (must not be {@code null}).
138135
* @see #findWebApplicationContext()
@@ -145,8 +142,7 @@ public DelegatingFilterProxy(String targetBeanName) {
145142
/**
146143
* Create a new {@code DelegatingFilterProxy} that will retrieve the named target
147144
* bean from the given Spring {@code WebApplicationContext}.
148-
* <p>For use in Servlet 3.0+ environments where instance-based registration of
149-
* filters is supported.
145+
* <p>For use with instance-based registration of filters.
150146
* <p>The target bean must implement the standard Servlet Filter interface.
151147
* <p>The given {@code WebApplicationContext} may or may not be refreshed when passed
152148
* in. If it has not, and if the context implements {@link ConfigurableApplicationContext},

0 commit comments

Comments
 (0)