这是我的登录方法
@RequestMapping(value = "/login", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<User> login(HttpServletRequest request){
request.getSession().setMaxInactiveInterval(10);
...
}
我将测试的会话超时设置为 10 秒。但这行不通。如何在特定时间后使会话无效?
试试这个:@RequestMapping(value = "/login", method = RequestMethod.GET) @ResponseBody public ResponseEntity login(HttpServletRequest request, HttpSession session){ session.setMaxInactiveInterval(10); }