Reputation: 2497
How can I get the ServletContext inside an Interceptor in Spring MVC 3?
Upvotes: 46
Views: 50835
Reputation: 242786
Since interceptor is a bean, you can simply autowire it:
@Autowired
ServletContext context;
Upvotes: 109
Reputation: 18639
Please look at this example
http://www.vaannila.com/spring/spring-interceptor.html
and then request.getSession().getServletContext()
Upvotes: 6