获取当前request
有时候需要在处理业务的时候用到request对象,可以使用该方法获取
HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
使用RequestContextHolder.currentRequestAttributes()获取的RequestAttributes对象是线程局部变量(ThreadLocal),request对象也是线程局部变量
https://zhhll.icu/2021/框架/springmvc/基础/9.spring获取当前request/
本文由mdnice多平台发布
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。