Commit b8e86473 authored by Brian Clozel's avatar Brian Clozel

Fix Servlet requirements in reference docs

As of Spring Framework 5.0, only Servlet 3.1+ containers are supported.
See https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-5.x

This commit updates the reference documentation to reflect that and also
removes sections describing pre-Servlet 3.1 solutions, as those are not
supported anymore.

Fixes gh-12370
parent 2561f320
...@@ -61,7 +61,7 @@ Spring Boot supports the following embedded servlet containers: ...@@ -61,7 +61,7 @@ Spring Boot supports the following embedded servlet containers:
|3.1 |3.1
|=== |===
You can also deploy Spring Boot applications to any Servlet 3.0+ compatible container. You can also deploy Spring Boot applications to any Servlet 3.1+ compatible container.
......
...@@ -2936,14 +2936,6 @@ example] of the previously described configuration. ...@@ -2936,14 +2936,6 @@ example] of the previously described configuration.
[[howto-create-a-deployable-war-file-for-older-containers]]
=== Create a Deployable War File for Older Servlet Containers
Older Servlet containers do not have support for the `ServletContextInitializer` bootstrap
process used in Servlet 3.0. You can still use Spring and Spring Boot in these containers,
but you are going to need to add a `web.xml` to your application and configure it to load
an `ApplicationContext` via a `DispatcherServlet`.
[[howto-convert-an-existing-application-to-spring-boot]] [[howto-convert-an-existing-application-to-spring-boot]]
=== Convert an Existing Application to Spring Boot === Convert an Existing Application to Spring Boot
...@@ -3110,70 +3102,6 @@ rather than the version that was pre-installed with the server. You can do so by ...@@ -3110,70 +3102,6 @@ rather than the version that was pre-installed with the server. You can do so by
[[howto-servlet-2-5]]
=== Deploying a WAR in an Old (Servlet 2.5) Container
Spring Boot uses Servlet 3.0 APIs to initialize the `ServletContext` (register `Servlets`
and so on), so you cannot use the same application in a Servlet 2.5 container.
It *is*, however, possible to run a Spring Boot application on an older container with some
special tools. If you include `org.springframework.boot:spring-boot-legacy` as a
dependency (https://github.com/scratches/spring-boot-legacy[maintained separately] to the
core of Spring Boot and currently available at 1.1.0.RELEASE), all you need to do
is create a `web.xml` and declare a context listener to create the application context and
your filters and servlets. The context listener is a special purpose one for Spring Boot,
but the rest of it is normal for a Spring application in Servlet 2.5. The following Maven
example shows how to set up a Spring Boot project to run in a Servlet 2.5 container:
[source,xml,indent=0]
----
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>demo.Application</param-value>
</context-param>
<listener>
<listener-class>org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>metricsFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>metricsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextAttribute</param-name>
<param-value>org.springframework.web.context.WebApplicationContext.ROOT</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
----
In the preceding example, we use a single application context (the one created by the
context listener) and attach it to the `DispatcherServlet` by using an `init` parameter.
This is normal in a Spring Boot application (you normally only have one application
context).
[[howto-use-jedis-instead-of-lettuce]] [[howto-use-jedis-instead-of-lettuce]]
=== Use Jedis Instead of Lettuce === Use Jedis Instead of Lettuce
By default, the Spring Boot starter (`spring-boot-starter-data-redis`) uses By default, the Spring Boot starter (`spring-boot-starter-data-redis`) uses
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment