@GetMapping("/setSession")
public Object setSession(HttpServletRequest request) {
HttpSession session = request.getSession();
session.setAttribute("userInfo", "new user");
session.setMaxInactiveInterval(3600);
session.getAttribute("userInfo");
// session.removeAttribute("userInfo");
return "ok";
}
/**
* Specifies the time, in seconds, between client requests before the
* servlet container will invalidate this session. A zero or negative time
* indicates that the session should never timeout.
*
* @param interval
* An integer specifying the number of seconds
*/
public void setMaxInactiveInterval(int interval);