How to inject dependencies into HttpSessionListener, using Spring and without calls, like context.getBean(\"foo-bar\") ?
You can declare your HttpSessionListener as a bean in Spring context, and register a delegation proxy as an actual listener in web.xml, something like this:
public class DelegationListener implements HttpSessionListener {
public void sessionCreated(HttpSessionEvent se) {
ApplicationContext context =
WebApplicationContextUtils.getWebApplicationContext(
se.getSession().getServletContext()
);
HttpSessionListener target =
context.getBean("myListener", HttpSessionListener.class);
target.sessionCreated(se);
}
...
}