Package com.google.inject.servlet
Class GuiceServletContextListener
- java.lang.Object
-
- com.google.inject.servlet.GuiceServletContextListener
-
- All Implemented Interfaces:
EventListener
,ServletContextListener
public abstract class GuiceServletContextListener extends Object implements ServletContextListener
As of Guice 2.0 you can still use (your subclasses of)GuiceServletContextListener
class as a logical place to create and configure your injector. This will ensure the injector is created when the web application is deployed.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description GuiceServletContextListener()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
contextDestroyed(ServletContextEvent servletContextEvent)
void
contextInitialized(ServletContextEvent servletContextEvent)
protected abstract Injector
getInjector()
Override this method to create (or otherwise obtain a reference to) your injector.
-
-
-
Method Detail
-
contextInitialized
public void contextInitialized(ServletContextEvent servletContextEvent)
- Specified by:
contextInitialized
in interfaceServletContextListener
-
contextDestroyed
public void contextDestroyed(ServletContextEvent servletContextEvent)
- Specified by:
contextDestroyed
in interfaceServletContextListener
-
getInjector
protected abstract Injector getInjector()
Override this method to create (or otherwise obtain a reference to) your injector.
-
-