第一步:
@Autowired
private HttpServletRequest httpServletRequest;
第二步:
存储session
HttpSession session = httpServletRequest.getSession();
session.setAttribute("id", one); //设置需要存储的key和value 默认存储时间为30分钟
第三步:
读取session
HttpSession session = httpServletRequest.getSession();
//读出出来的是一个对象 需要进行二次处理
Object id = session.getAttribute("id");
Integer ids = Integer.parseInt(id.toString());
标签:httpServletRequest,存储,SpringBoot,session,关于,Integer,id
From: https://www.cnblogs.com/lijiaxiang/p/16934429.html