You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto.adoc
+11-48
Original file line number
Diff line number
Diff line change
@@ -734,6 +734,11 @@ The example below is for Tomcat with the `spring-boot-starter-web` (Servlet stac
734
734
}
735
735
----
736
736
737
+
NOTE: Spring Boot uses that infrastructure internally to auto-configure the server.
738
+
Auto-configured `WebServerFactoryCustomizer` beans have an order of `0` and will be processed before any user-defined customizers, unless it has an explicit order that states otherwise.
739
+
740
+
Once you've got access to a `WebServerFactory` using the customizer, you can use it to configure specific parts, like connectors, server resources, or the server itself - all using server-specific APIs.
741
+
737
742
In addition Spring Boot provides:
738
743
739
744
[[howto-configure-webserver-customizers]]
@@ -758,10 +763,8 @@ In addition Spring Boot provides:
758
763
| `NettyReactiveWebServerFactory`
759
764
|===
760
765
761
-
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 using server-specific APIs.
762
-
763
-
As a last resort, you can also declare your own `WebServerFactory` component, which will override the one provided by Spring Boot.
764
-
In this case, you can't rely on configuration properties in the `server` namespace anymore.
766
+
As a last resort, you can also declare your own `WebServerFactory` bean, which will override the one provided by Spring Boot.
767
+
When you do so, auto-configured customizers are still applied on your custom factory, so use that option carefully.
765
768
766
769
767
770
@@ -918,7 +921,7 @@ You can customize the valve's configuration by adding an entry to `application.p
918
921
919
922
NOTE: You can trust all proxies by setting the `internal-proxies` to empty (but do not do so in production).
920
923
921
-
You can take complete control of the configuration of Tomcat's `RemoteIpValve` by switching the automatic one off (to do so, set `server.forward-headers-strategy=NONE`) and adding a new valve instance in a `TomcatServletWebServerFactory` bean.
924
+
You can take complete control of the configuration of Tomcat's `RemoteIpValve` by switching the automatic one off (to do so, set `server.forward-headers-strategy=NONE`) and adding a new valve instance using a `WebServerFactoryCustomizer` bean.
922
925
923
926
924
927
@@ -928,35 +931,7 @@ You can add an `org.apache.catalina.connector.Connector` to the `TomcatServletWe
@@ -2432,7 +2395,7 @@ You can switch on the valve by adding some entries to `application.properties`,
2432
2395
----
2433
2396
2434
2397
(The presence of either of those properties switches on the valve.
2435
-
Alternatively, you can add the `RemoteIpValve` by adding a `TomcatServletWebServerFactory` bean.)
2398
+
Alternatively, you can add the `RemoteIpValve` by customizing the `TomcatServletWebServerFactory` using a `WebServerFactoryCustomizer` bean.)
2436
2399
2437
2400
To configure Spring Security to require a secure channel for all (or some) requests, consider adding your own `SecurityFilterChain` bean that adds the following `HttpSecurity` configuration:
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc
+10-14
Original file line number
Diff line number
Diff line change
@@ -3462,30 +3462,26 @@ The following example shows programmatically setting the port:
3462
3462
}
3463
3463
----
3464
3464
3465
-
NOTE: `TomcatServletWebServerFactory`, `JettyServletWebServerFactory` and `UndertowServletWebServerFactory` are dedicated variants of `ConfigurableServletWebServerFactory` that have additional customization setter methods for Tomcat, Jetty and Undertow respectively.
3465
+
`TomcatServletWebServerFactory`, `JettyServletWebServerFactory` and `UndertowServletWebServerFactory` are dedicated variants of `ConfigurableServletWebServerFactory` that have additional customization setter methods for Tomcat, Jetty and Undertow respectively.
3466
+
The following example shows how to customize `TomcatServletWebServerFactory` that provides access to Tomcat-specific configuration options:
If the preceding customization techniques are too limited, you can register the `TomcatServletWebServerFactory`, `JettyServletWebServerFactory`, or `UndertowServletWebServerFactory` bean yourself.
3472
-
3473
-
[source,java,indent=0]
3474
-
----
3475
-
@Bean
3476
-
public ConfigurableServletWebServerFactory webServerFactory() {
3477
-
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
0 commit comments