Announcement Announcement Module
No announcement yet.
Session scope design question - multiple beans Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Session scope design question - multiple beans

    I'm in the process of cleaning up the code in an existing web app that I've got running. As part of the process, I'm trying to adopt Spring as much as possible. I've got a question about my user-specific session-scoped data that I maintain for each session. I gather this data from several places (LDAP, database, etc).

    I'm trying to determine the preferred approach for storing this data.

    The first option would be to have one "userinfo"-type wrapper bean in session scope that gets injected with "request"-scoped getters for each of the data items. I'd then store the returns from each getter (typically a List<Entity> or an Entity) as properties in the userinfo bean. This would minimize the number of session-scoped beans in the app, but would require me to access all of the data through this wrapper bean.

    The second option I'm considering is just to set each of the "getter" beans to session scope, and access the data directly that way. This obviously requires more session-scoped beans, but seems to be more appropriate from the standpoint of separating the concerns.

    Any input appreciated.