How to inject dependencies into HttpSessionListener, using Spring?
问题 How to inject dependencies into HttpSessionListener, using Spring and without calls, like context.getBean("foo-bar") ? 回答1: Since the Servlet 3.0 ServletContext has an "addListener" method, instead of adding your listener in your web.xml file you could add through code like so: @Component public class MyHttpSessionListener implements javax.servlet.http.HttpSessionListener, ApplicationContextAware { @Override public void setApplicationContext(ApplicationContext applicationContext) throws