简体   繁体   English

Spring bean RequestScope 与 Webflux

[英]Spring bean RequestScope with Webflux

Is there a pattern to use @RequestScope with Webflux?是否有将 @RequestScope 与 Webflux 一起使用的模式? We used the approach suggested here ( https://www.baeldung.com/spring-bean-scopes ) but it gives below error.我们使用了这里建议的方法( https://www.baeldung.com/spring-bean-scopes )但它给出了以下错误。

No scope registered for scope name request没有为 scope 名称请求注册的 scope

Request scope works on ThreadLocal which is not supported by Webflux because part of work can be delegated between threads and you cannot assume that request will be handled by one thread.请求 scope 在 Webflux 不支持的 ThreadLocal 上工作,因为部分工作可以在线程之间委派,您不能假设请求将由一个线程处理。

In such a case, you should take a look at Reactor Context which allows you to connect data with the request scope.在这种情况下,您应该查看Reactor Context ,它允许您使用请求 scope 连接数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring webflux bean 验证不起作用 - Spring webflux bean validation not working bean验证不适用于spring webflux - Bean validation is not working for spring webflux Spring Webflux是否支持Javax Bean验证? - Does spring webflux supports javax bean validation? 获取 NoSuchBeanDefinitionException:在 Spring WebFlux 中没有 ServerRequest 类型的合格 bean - Getting NoSuchBeanDefinitionException: No qualifying bean of type ServerRequest in Spring WebFlux 在安全的 Spring Boot Webflux 应用程序中调用了两次 WebFilter bean - WebFilter bean invoked twice in a secured Spring Boot Webflux application 在WebFlux中创建名称为requestMappingHandlerMapping的bean时出错(没有Spring Boot) - Error creating bean with name requestMappingHandlerMapping in WebFlux (without Spring Boot) 如何在Spring Boot和Spring WebFlux中使用“功能bean定义Kotlin DSL”? - How to use “Functional bean definition Kotlin DSL” with Spring Boot and Spring WebFlux? 如何使用 Spring Boot Security 修复 Spring Boot Webflux 应用程序中的“名称为 requestMappingHandlerAdapter 的无效 bean 定义”错误 - How to fix 'Invalid bean definition with name requestMappingHandlerAdapter' error in Spring Boot Webflux app with Spring Boot Security Spring 5 WebFlux 中的拦截器 - Interceptor in Spring 5 WebFlux Spring Webflux-多单声道 - Spring webflux - multi Mono
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM