The interface ServletContextAware
is what you are looking for. It provides the method
setServletContext(ServletContext servletContext)
which Spring will use to inject the application context. In your case, this will be the ServletContext
created by your servlet container.
You should not be using this with ServletContextListener
as you have it in your question since a ServletContextListener
is initialized by the servlet container and not by Spring. Spring cannot therefore do its magic.