[英]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.