How to store session in Spring MVC

前端 未结 1 1456
予麋鹿
予麋鹿 2021-01-30 10:40

What\'s the best way of storing session related data of a user (like, for example a log of recent actions a user has done) in a Spring MVC (2.5) web application ?

Using

1条回答
  •  遥遥无期
    2021-01-30 11:17

    Session-scoped beans (using scope="session") is the cleanest approach. This removes the need to interact with the session yourself.

    If you want to autowire a session-scoped bean in to the controller, you either need to make the controller session-scoped itself, or use a scoped-proxy to wire it into a singleton controller, as described here. Either approach is valid.

    0 讨论(0)
提交回复
热议问题