【问题标题】:how to get a Spring bean that is local to the current HttpRequest如何获取当前 HttpRequest 本地的 Spring bean
【发布时间】:2010-03-04 18:34:46
【问题描述】:

我希望能够创建一个范围仅限于当前服务的 HttpRequest 的 bean。

我考虑过ThreadLocal,但我看到的问题是线程可以被容器重用于服务一个HttpRequest。我想在没有当前服务的 HttpRequest 概念的 bean 中使用所述 bean。任何指导表示赞赏。

【问题讨论】:

    标签: java spring httprequest


    【解决方案1】:

    使用可以使用请求范围的bean:3.5.4. Request, session, and global session scopes

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-20
      • 2015-07-04
      • 2014-07-06
      • 1970-01-01
      • 2014-01-27
      • 2014-03-16
      相关资源
      最近更新 更多