mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
pass scm-manager stage to google guice
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm;
|
||||
|
||||
/**
|
||||
@@ -46,10 +47,41 @@ public enum Stage
|
||||
/**
|
||||
* This value indicates SCM-Manager is right now in development.
|
||||
*/
|
||||
DEVELOPMENT,
|
||||
DEVELOPMENT(com.google.inject.Stage.DEVELOPMENT),
|
||||
|
||||
/**
|
||||
* This value indicates SCM-Manager is right now productive.
|
||||
*/
|
||||
PRODUCTION
|
||||
PRODUCTION(com.google.inject.Stage.PRODUCTION);
|
||||
|
||||
/**
|
||||
* Constructs a new Stage
|
||||
*
|
||||
*
|
||||
* @param injectionStage injection stage
|
||||
*/
|
||||
private Stage(com.google.inject.Stage injectionStage)
|
||||
{
|
||||
this.injectionStage = injectionStage;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Returns the injection stage
|
||||
*
|
||||
*
|
||||
* @return injection stage
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public com.google.inject.Stage getInjectionStage()
|
||||
{
|
||||
return injectionStage;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** injection stage */
|
||||
private final com.google.inject.Stage injectionStage;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ import org.apache.shiro.guice.web.ShiroWebModule;
|
||||
import sonia.scm.cache.CacheManager;
|
||||
import sonia.scm.group.GroupManager;
|
||||
import sonia.scm.plugin.DefaultPluginLoader;
|
||||
import sonia.scm.repository.HealthCheckContextListener;
|
||||
import sonia.scm.repository.RepositoryManager;
|
||||
import sonia.scm.store.StoreFactory;
|
||||
import sonia.scm.upgrade.UpgradeManager;
|
||||
@@ -59,7 +60,6 @@ import java.util.List;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import sonia.scm.repository.HealthCheckContextListener;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -196,7 +196,9 @@ public class ScmContextListener extends GuiceServletContextListener
|
||||
moduleList.addAll(pluginLoader.getInjectionModules());
|
||||
moduleList.addAll(overrides.getModules());
|
||||
|
||||
return Guice.createInjector(moduleList);
|
||||
SCMContextProvider ctx = SCMContext.getContext();
|
||||
|
||||
return Guice.createInjector(ctx.getStage().getInjectionStage(), moduleList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user