本文整理汇总了Java中com.google.inject.Stage.PRODUCTION属性的典型用法代码示例。如果您正苦于以下问题:Java Stage.PRODUCTION属性的具体用法?Java Stage.PRODUCTION怎么用?Java Stage.PRODUCTION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.inject.Stage
的用法示例。
在下文中一共展示了Stage.PRODUCTION属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGuiceStage
public Stage getGuiceStage(){
String stageString = System.getProperty(PROPERTY_NAME);
final Stage stage;
boolean development = Stage.DEVELOPMENT.name().equals(stageString);
boolean production = Stage.PRODUCTION.name().equals(stageString);
if(development || production){
stage = development ? Stage.DEVELOPMENT : Stage.PRODUCTION;
logger.warn("using Guice Stage {} from JVM arg -D{}={}", stage, PROPERTY_NAME, stageString);
}else if(stageString != null){
stage = Stage.PRODUCTION;
logger.warn("unrecognized JVM arg value -D{}={}, using Guice Stage {}", PROPERTY_NAME, stageString,
Stage.PRODUCTION);
}else{
stage = Stage.PRODUCTION;
logger.warn("using default Guice Stage={}", Stage.PRODUCTION);
}
return stage;
}
示例2: testCorrectStage
public void testCorrectStage() {
final Stage stage = Stage.PRODUCTION;
Module module =
Modules.override(
new AbstractModule() {
@Override
protected void configure() {
if (currentStage() != Stage.PRODUCTION) {
addError("Wronge stage in overridden module:" + currentStage());
}
}
})
.with(
new AbstractModule() {
@Override
protected void configure() {
if (currentStage() != Stage.PRODUCTION) {
addError("Wronge stage in overriding module:" + currentStage());
}
}
});
Guice.createInjector(stage, module);
}
示例3: testCorrectStage
public void testCorrectStage() {
final Stage stage = Stage.PRODUCTION;
Module module = Modules.override(new AbstractModule() {
@Override
protected void configure() {
if (currentStage() != Stage.PRODUCTION) {
addError("Wronge stage in overridden module:" + currentStage());
}
}
}).with(new AbstractModule() {
@Override
protected void configure() {
if (currentStage() != Stage.PRODUCTION) {
addError("Wronge stage in overriding module:" + currentStage());
}
}
});
Guice.createInjector(stage, module);
}
示例4: getStage
/**
* Override this method to specify which stage to run Guice in.
* Default behavior is to look first in user preferences and then
* in system preferences for node "org/directwebremoting/guice"
* with a value for key "stage". If not found, the default is
* Stage.PRODUCTION.
*/
protected Stage getStage()
{
Stage stage = Stage.PRODUCTION;
try
{
Preferences userNode = Preferences.userNodeForPackage(PACKAGE);
String userStage = userNode.get(STAGE_KEY, null);
if (userStage != null)
{
stage = Stage.valueOf(userStage);
}
else
{
Preferences systemNode = Preferences.systemNodeForPackage(PACKAGE);
String systemStage = systemNode.get(STAGE_KEY, null);
if (systemStage != null)
{
stage = Stage.valueOf(systemStage);
}
}
}
catch (Exception e)
{
// ignore errors reading Preferences
}
return stage;
}
示例5: currentStage
@Override
public Stage currentStage() {
switch (delegate.currentStage()) {
case DEVELOPMENT:
return Stage.DEVELOPMENT;
case PRODUCTION:
return Stage.PRODUCTION;
default:
throw new UnsupportedOperationException();
}
}
示例6: isEagerSingleton
/** Returns true if this scope is a singleton that should be loaded eagerly in {@code stage}. */
public boolean isEagerSingleton(Stage stage) {
if (this == EAGER_SINGLETON) {
return true;
}
if (stage == Stage.PRODUCTION) {
return this == SINGLETON_ANNOTATION || this == SINGLETON_INSTANCE;
}
return false;
}
示例7: isEagerSingleton
/**
* Returns true if this scope is a singleton that should be loaded eagerly in {@code stage}.
*/
public boolean isEagerSingleton(Stage stage) {
if (this == EAGER_SINGLETON) {
return true;
}
if (stage == Stage.PRODUCTION) {
return this == SINGLETON_ANNOTATION || this == SINGLETON_INSTANCE;
}
return false;
}
示例8: stage
protected Stage stage() {
if (System.getenv("TEST") != null || System.getenv("DEV") != null)
return Stage.DEVELOPMENT;
return Stage.PRODUCTION;
}
示例9: HttpServerExample
public HttpServerExample() {
super(Stage.PRODUCTION, new Module());
}
示例10: HttpMultithreadedServerExample
public HttpMultithreadedServerExample() {
super(Stage.PRODUCTION, new Module());
}
示例11: ServerSetupExample
public ServerSetupExample() {
super(Stage.PRODUCTION, new Module());
}
示例12: RpcServerLauncher
public RpcServerLauncher() {
super(Stage.PRODUCTION, new RpcServerModule());
}
示例13: RpcClientLauncher
public RpcClientLauncher() {
super(Stage.PRODUCTION, new RpcClientModule());
}
示例14: UIKernelWebAppLauncher
public UIKernelWebAppLauncher() {
super(Stage.PRODUCTION,
ServiceGraphModule.defaultInstance(),
PropertiesConfigModule.ofFile("configs.properties"),
new UIKernelWebAppModule());
}
示例15: HttpHelloWorldLauncher
public HttpHelloWorldLauncher() {
super(Stage.PRODUCTION, ConfigsModule.create(PropertiesConfig.ofProperties("configs.properties")), new HttpHelloWorldModule());
}