Netflix/governator — pull request #142 by elandau (2014-07-05 16:06:00+00:00)
Title: Governator bootstrap based servlet subproject

Integrate GuiceServletContextListener into Governator's bootstrap mechanism. This integration will drive LifecycleManager start()/close() from the ServletContext events. In addition it provides a mechanism to hook into the ServletContextListener via a custom ServletContextListener that is created within the context of Guice and can therefore inject dependencies.

Example,

web.xml
```xml

governator.bootstrap.class
com.myorg.MyBootstrap

guiceFilter
com.google.inject.servlet.GuiceFilter

guiceFilter
/*

com.netflix.governator.guice.servlet.GovernatorServletContextListener

```

This is the Governator bootstrap enabled class.
```java
@Modules(include={SomeServiceModule.class})
public class MyBootstrap extends AbstractModule {
protected void configure() {
bind(ServletContextListener.class).to(MyServletContextListener.class);
}
}
```

This is the custom ServletContextListener that can have dependencies injected into it.
```java
public class MyServletContextListener implements ServletContextListener {
private final SomeService service;

@Inject
public MyServletContextListener(SomeService service) {
this.service = service;
}
@Override
public void contextInitialized(final ServletContextEvent event) {
service.doSomeStartupTask();
}
}
```