spring - 是否可以生成请求范围?
问题描述
我在我的应用程序中使用了请求范围的 bean:
@Bean
@RequestScope
public BeanA beanA(){
return new BeanA();
}
而且,只要我收到网络请求就可以了。问题是我现在还支持其他请求源(例如 Spring 数据 redis 侦听器)但是,当我想用我得到的值填充它时
no thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
是否可以创建请求范围?
解决方案
推荐阅读
- scala - Spark Structured Streaming MemoryStream + Row + Encoders 问题
- java - 通过 gremlin java 客户端将数据远程推送到 Azure Cosmos db 时出错
- android - 对不同的按钮使用相同的活动,但使用 xml 资源执行不同的操作
- javascript - 为什么滚动时我的粘性导航栏的高度会消失?
- javascript - 在对象属性中拆分字符串并创建新数据集
- python - 一堆立方体的体积
- sabre - 调用 Sabre BargainFinderMax REST API 时出错 — ERR.2SG.PROVIDER_TIMEOUT
- python - url 未定义,在 python 和 selenium 中
- android - PopupMenu - 如何?
- android - camera2 大小的表面视图