Skip to content

Commit 2c309c5

Browse files
committed
Merge branch '2.1.x'
Closes gh-18879
2 parents 63dd159 + 1c6f2af commit 2c309c5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2787,9 +2787,11 @@ Filters map to `+/*+`.
27872787

27882788
If convention-based mapping is not flexible enough, you can use the `ServletRegistrationBean`, `FilterRegistrationBean`, and `ServletListenerRegistrationBean` classes for complete control.
27892789

2790-
Filter beans can be ordered to control their position in the filter chain by using `@Order` or implemented `Ordered`.
27912790
It is usually safe to leave Filter beans unordered.
2792-
However, if a specific order is required, you should avoid configuring a Filter that reads the request body at `Ordered.HIGHEST_PRECEDENCE`, since it might go against the character encoding configuration of your application.
2791+
If a specific order is required, you should annotate the `Filter` with `@Order` or make it implement `Ordered`.
2792+
You cannot configure the order of a `Filter` by annotating its bean method with `@Order`.
2793+
If you cannot change the `Filter` class to add `@Order` or implement `Ordered`, you must define a `FilterRegistrationBean` for the `Filter` and set the registration bean's order using the `setOrder(int)` method.
2794+
Avoid configuring a Filter that reads the request body at `Ordered.HIGHEST_PRECEDENCE`, since it might go against the character encoding configuration of your application.
27932795
If a Servlet filter wraps the request, it should be configured with an order that is less than or equal to `OrderedFilter.REQUEST_WRAPPER_FILTER_MAX_ORDER`.
27942796

27952797
TIP: To see the order of every `Filter` in your application, enable debug level logging for the `web` <<boot-features-custom-log-groups,logging group>> (`logging.level.web=debug`).

0 commit comments

Comments
 (0)