> For the complete documentation index, see [llms.txt](https://jack80342.gitbook.io/spring-boot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jack80342.gitbook.io/spring-boot/iv.-spring-boot-features/27.-developing-web-applications/27.2-the-spring-webflux-framework/27.2.6-web-filters.md).

# 27.2.6 网络过滤器

Spring WebFlux提供了`WebFilter`接口。它可以用来过滤HTTP请求-响应交换。在应用上下文里的`WebFilter`将会自动用于过滤每一个交换。

过滤器的顺序很重要。它们可以实现`Ordered`，或者标注`@Order`。Spring Boot会为你自动配置网络过滤器，顺序如下：

| Web Filter                             | Order                            |
| -------------------------------------- | -------------------------------- |
| `MetricsWebFilter`                     | `Ordered.HIGHEST_PRECEDENCE + 1` |
| `WebFilterChainProxy`(Spring Security) | `-100`                           |
| `HttpTraceWebFilter`                   | `Ordered.LOWEST_PRECEDENCE - 10` |
