com.google.inject.servlet
Class GuiceServletContextListener

java.lang.Object
  extended by com.google.inject.servlet.GuiceServletContextListener
All Implemented Interfaces:
EventListener, javax.servlet.ServletContextListener

public abstract class GuiceServletContextListener
extends Object
implements javax.servlet.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
GuiceServletContextListener()
           
 
Method Summary
 void contextDestroyed(javax.servlet.ServletContextEvent servletContextEvent)
           
 void contextInitialized(javax.servlet.ServletContextEvent servletContextEvent)
           
protected abstract  Injector getInjector()
          Override this method to create (or otherwise obtain a reference to) your injector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GuiceServletContextListener

public GuiceServletContextListener()
Method Detail

contextInitialized

public void contextInitialized(javax.servlet.ServletContextEvent servletContextEvent)
Specified by:
contextInitialized in interface javax.servlet.ServletContextListener

contextDestroyed

public void contextDestroyed(javax.servlet.ServletContextEvent servletContextEvent)
Specified by:
contextDestroyed in interface javax.servlet.ServletContextListener

getInjector

protected abstract Injector getInjector()
Override this method to create (or otherwise obtain a reference to) your injector.