Issues in using AutoWired HttpSession:
LoginController calls LoginService passing HttpServletRequest as parameter.
I've autowired HttpSession like this in few other annotated classes (but NOT in LoginService):
@Autowired
private HttpSession httpSession;
In LoginService class, if I try to get session by calling request.getSession(false)
I receive null in some instances.
If I try to get session by calling request.getSession(true)
I am ending up with two HttpSession objects (one here and another one thru AutoWiring).
If I autowire HttpSession in LoginServic class and use the session from there, then also I am ending with two HttpSession objects.
When exactly autowired HttpSession will be created? What is the best way to handle this situation?
Thanks!