Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
a4ee33bf
Commit
a4ee33bf
authored
Jun 06, 2018
by
Rossen Stoyanchev
Committed by
Brian Clozel
Jun 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Follow-up dates for web server config documentation
See gh-13315
parent
34167dc1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
16 deletions
+37
-16
howto.adoc
...oot-project/spring-boot-docs/src/main/asciidoc/howto.adoc
+37
-16
No files found.
spring-boot-project/spring-boot-docs/src/main/asciidoc/howto.adoc
View file @
a4ee33bf
...
...
@@ -506,15 +506,17 @@ configure the embedded server. This section answers those questions.
[[howto-use-another-web-server]]
=== Use Another Web Server
Many Spring Boot starters include default embedded containers. `spring-boot-starter-web`
includes Tomcat by including `spring-boot-starter-tomcat`, but you can use
`spring-boot-starter-jetty` or `spring-boot-starter-undertow` instead.
`spring-boot-starter-webflux` includes Reactor Netty by including
`spring-boot-starter-reactor-netty`, but you can use `spring-boot-starter-tomcat`,
Many Spring Boot starters include default embedded containers.
* For servlet stack applications, the `spring-boot-starter-web` includes Tomcat by including
`spring-boot-starter-tomcat`, but you can use `spring-boot-starter-jetty` or
`spring-boot-starter-undertow` instead.
* For reactive stack applications, the `spring-boot-starter-webflux` includes Reactor Netty
by including `spring-boot-starter-reactor-netty`, but you can use `spring-boot-starter-tomcat`,
`spring-boot-starter-jetty`, or `spring-boot-starter-undertow` instead.
If you need to use
a different HTTP server, you need to exclude the default dependencies
and include
the one you need. Spring Boot provides separate starters for
When switching to
a different HTTP server, you need to exclude the default dependencies
in addition to including
the one you need. Spring Boot provides separate starters for
HTTP servers to help make this process as easy as possible.
The following Maven example shows how to exclude Tomcat and include Jetty for Spring MVC:
...
...
@@ -768,7 +770,7 @@ You can declare such a component and get access to the server factory relevant t
choice: you should select the variant for the chosen Server (Tomcat, Jetty, Reactor Netty,
Undertow) and the chosen web stack (Servlet or Reactive).
In the following example, we're using Tomcat in a Servlet-based web application
:
The example below is for Tomcat with the `spring-boot-starter-web` (Servlet stack)
:
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
...
...
@@ -783,12 +785,30 @@ In the following example, we're using Tomcat in a Servlet-based web application:
}
----
Spring Boot currently provides:
In addition Spring Boot provides:
[[howto-configure-webserver-customizers]]
[cols="1,2,2", options="header"]
|===
| Server | Servlet stack | Reactive stack
| Tomcat
| `TomcatServletWebServerFactory`
| `TomcatReactiveWebServerFactory`
* `TomcatServletWebServerFactory` and `TomcatReactiveWebServerFactory` for Tomcat
* `JettyServletWebServerFactory` and `JettyReactiveWebServerFactory` for Jetty
* `UndertowServletWebServerFactory` and `UndertowReactiveWebServerFactory` for Undertow
* `NettyReactiveWebServerFactory` for Reactor Netty
| Jetty
| `JettyServletWebServerFactory`
| `JettyReactiveWebServerFactory`
| Undertow
| `UndertowServletWebServerFactory`
| `UndertowReactiveWebServerFactory`
| Reactor
| N/A
| `NettyReactiveWebServerFactory`
|===
Once you've got access to a `WebServerFactory`, you can often add customizers to it to
configure specific parts, like connectors, server resources, or the server itself - all
...
...
@@ -801,9 +821,10 @@ properties in the `server` namespace anymore.
[[howto-add-a-servlet-filter-or-listener]]
=== Add a Servlet, Filter, or Listener to an Application
There are two ways to add `Servlet`, `Filter`, `ServletContextListener`, and the other
listeners supported by the Servlet spec to your application:
=== Add a Servlet, Filter, or Listener to a Application
In a servlet stack application, i.e. with the `spring-boot-starter-web`, there are two
ways to add `Servlet`, `Filter`, `ServletContextListener`, and the other listeners
supported by the Servlet API to your application:
* <<howto-add-a-servlet-filter-or-listener-as-spring-bean>>
* <<howto-add-a-servlet-filter-or-listener-using-scanning>>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment