开发者

Spring annotations : setting @sessionAttributes in @component class

开发者 https://www.devze.com 2023-02-08 05:28 出处:网络
Is it possible to set a session attribute in a manager class (class which is not a controller and is marked as @component)?

Is it possible to set a session attribute in a manager class (class which is not a controller and is marked as @component)? The scenario is like this, from my Controller i'm calling a manag开发者_高级运维er class which does some logic. I want to store the result of this logic in the session, so that i can use it in the later requests.


No. @SessionAttribute is a controller-specific concept. To get similar behaviour in other components you can use session-scoped beans.

0

精彩评论

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