Make LifecycleModule inherit from FactoryModule
Cut down on a bunch of one-offs of install(new *Module() {...}) by
choosing a more appropriate base module class. This doesn't solve all
such cases, for example RpcServletModule must still inherit from
ServletModule, but it does clean up some code. (And who knows, fewer
modules may even mean faster startup time.)
Change-Id: Ie1aed05d0a64f7f11b121c9a637bb30d80e9a595
This commit is contained in:
@@ -196,16 +196,10 @@ public class WebAppInitializer extends GuiceServletContextListener
|
||||
final DataSourceType dst = Guice.createInjector(new DataSourceModule(),
|
||||
configModule, sitePathModule).getInstance(
|
||||
Key.get(DataSourceType.class, Names.named(dbType.toLowerCase())));
|
||||
modules.add(new AbstractModule() {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(DataSourceType.class).toInstance(dst);
|
||||
}
|
||||
});
|
||||
|
||||
modules.add(new LifecycleModule() {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(DataSourceType.class).toInstance(dst);
|
||||
bind(DataSourceProvider.Context.class).toInstance(
|
||||
DataSourceProvider.Context.MULTI_USER);
|
||||
bind(Key.get(DataSource.class, Names.named("ReviewDb"))).toProvider(
|
||||
|
||||
Reference in New Issue
Block a user