欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

获取applicationContext、获取request

程序员文章站 2022-05-25 10:57:40
...

1.获取applicationContext

ApplicationContext applicationContext= WebApplicationContextUtils.getWebApplicationContext(event.getServletContext());

2.获取request

HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();