在Spring容器中使用AOP做日志监控的时候需要拿到Session
通过以下代码可以拿到HttpServlet,有空研究了哈RequestContextHolder,使用了ThreadLocal来管理多线程并发时对象还能拿到自己线程中的对象。
HttpServletRequest httpServletRequest = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();