Spring lifecycle issue: the annotation @SessionAttributes makes session attributes live longer than the session itself
问题 here is the code that can reproduce this issue: @Controller public class FirstController { @RequestMapping(value = "firstpage", method = GET) public String myHander(HttpSession httpSession) { if (httpSession.getAttribute("someClass") == null) { httpSession.setAttribute("someClass", new SomeClass()); } return "firstpage"; } } the first controller puts something in the session if it's not already there. @Controller @SessionAttributes(types = SomeClass.class) public class SecondController {