Using a Session Scoped Bean
- by jboyd
The following code is returning null:
private MyAppUser getMyAppUser(HttpSession session) {
MyAppUser myAppUser = (MyAppUser) session.getAttribute("myAppUserManager");
return myAppUser;
}
Despite the fact that I have the following in my context:
<bean id="myAppUserManager" class="com.myapp.profile.MyAppUser" scope="session"/>
This doesn't make any sense to me, the "myAppUser" bean is a bean that absolutely can never be null, and I need to be able to reference it from controllers, I don't need it in services or repositories, just controllers, but it doesn't seem to be getting stored in the session, the use case is extremely simple, but I haven't been able to get to the bottom of what's wrong, or come up with a good workaround