spring boot为spring session生成uuid
也可以使用session自带的id,这里演示的是使用自定义uuid为session生成的id
@RequestMapping(value = "/uuid", method = RequestMethod.GET) public @ResponseBody String uid(HttpSession session) { UUID uid = (UUID) session.getAttribute("uuid"); if (uid == null) { uid = UUID.randomUUID(); } log.info("getMaxInactiveInterval = ", session.getMaxInactiveInterval()); session.setAttribute("uuid", uid); return session.getId(); }