开发者

how to get a Spring bean that is local to the current HttpRequest

开发者 https://www.devze.com 2022-12-22 10:06 出处:网络
I would like to be able to create a bean whose scope is limited to the currently serviced HttpRequest.

I would like to be able to create a bean whose scope is limited to the currently serviced HttpRequest.

I considered ThreadLocal but the problem I see is that threads can be reused to service an HttpRequest by the container. I would like to use said bean in a bean that has no conce开发者_运维问答pt of the currently serviced HttpRequest. Any guidance appreciated.


Use can use request-scoped beans: 3.5.4. Request, session, and global session scopes

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号