The following code returns null:
AController.java
private MyAppUser getMyAppUser(HttpSession session) {
MyAppUser myAppUser = (MyAppUser) session.getAttribute("myAppUserManager");
return myAppUser;
}
I also tried this:
AController.java
@Autowired
MyAppUser myAppUser;
Despite the fact that in my context, I have the following:
<bean id="myAppUserManager" class="com.myapp.profile.MyAppUser" scope="session"/>
It doesn’t make any sense to me, the "myAppUser" bean is a bean that can absolutely never be null, and I need to be able to refer to it from controllers, I don’t need this in services or repositories, just controllers, but it seems , they are not stored in the session, the precedent is extremely simple, but I could not figure out what happened, or come up with a good workaround
source
share