Skip to content

io microsphere spring webflux server filter RequestContextWebFilter

github-actions[bot] edited this page Jul 11, 2026 · 25 revisions

RequestContextWebFilter

Type: Class | Module: microsphere-spring-webflux | Package: io.microsphere.spring.webflux.server.filter | Since: 1.0.0

Source: microsphere-spring-webflux/src/main/java/io/microsphere/spring/webflux/server/filter/RequestContextWebFilter.java

Overview

The variant RequestContextFilter for Spring WebFlux

Declaration

public class RequestContextWebFilter implements WebFilter, Ordered

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.2.36-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-spring-webflux</artifactId>
    <version>${microsphere-spring.version}</version>
</dependency>

Tip: Use the BOM (microsphere-spring-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.spring.webflux.server.filter.RequestContextWebFilter;

API Reference

Public Methods

Method Description
filter
setThreadContextInheritable Set whether to expose the LocaleContext and RequestAttributes as inheritable
isThreadContextInheritable Get whether to expose the LocaleContext and RequestAttributes into InheritableThreadLocal.
getOrder

Method Details

setThreadContextInheritable

public void setThreadContextInheritable(boolean threadContextInheritable)

Set whether to expose the LocaleContext and RequestAttributes as inheritable for child threads (using an java.lang.InheritableThreadLocal).

Default is "false", to avoid side effects on spawned background threads. Switch this to "true" to enable inheritance for custom child threads which are spawned during request processing and only used for this request (that is, ending after their initial task, without reuse of the thread).

WARNING: Do not use inheritance for child threads if you are accessing a thread pool which is configured to potentially add new threads on demand (for example, a JDK java.util.concurrent.ThreadPoolExecutor), since this will expose the inherited context to such a pooled thread.

isThreadContextInheritable

public boolean isThreadContextInheritable()

Get whether to expose the LocaleContext and RequestAttributes into InheritableThreadLocal.

See Also

  • RequestContextFilter

This documentation was auto-generated from the source code of microsphere-spring.

Home

spring-context

spring-guice

spring-jdbc

spring-test

spring-web

spring-webflux

spring-webmvc

Clone this wiki locally