当前位置: 首页>>代码示例>>Java>>正文


Java Stage.DEVELOPMENT属性代码示例

本文整理汇总了Java中com.google.inject.Stage.DEVELOPMENT属性的典型用法代码示例。如果您正苦于以下问题:Java Stage.DEVELOPMENT属性的具体用法?Java Stage.DEVELOPMENT怎么用?Java Stage.DEVELOPMENT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.inject.Stage的用法示例。


在下文中一共展示了Stage.DEVELOPMENT属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

@Override
protected void configure() {
    // @InjectorScoped annotation
    install(new InjectorScopeModule());

    // Provide a global, catch-all exception handler
    bind(LoggingExceptionHandler.class).in(Singleton.class);
    bind(ExceptionHandler.class).to(LoggingExceptionHandler.class);
    bind(new TypeLiteral<ExceptionHandler<Throwable>>(){}).to(LoggingExceptionHandler.class);
    bind(Thread.UncaughtExceptionHandler.class).to(LoggingExceptionHandler.class);

    // Evil decorator thing
    // Create it manually so we can use it before the injector is ready
    bind(DecoratorFactory.class).toInstance(DecoratorFactory.get());

    install(new NumberFactory.Manifest());

    install(new ParsersManifest());

    requestStaticInjection(SystemFutureCallback.class);

    if(currentStage() == Stage.DEVELOPMENT) {
        // This is useful, but it makes the LeakDetector unhappy
        //install(new RepeatInjectionDetector());
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:26,代码来源:UtilCoreManifest.java

示例2: 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;
}
 
开发者ID:hotpads,项目名称:datarouter,代码行数:18,代码来源:GuiceStageFinder.java

示例3: getInjector

@Override
protected Injector getInjector() {
	/**
	 * This is called by super's contextInitialized.
	 * 
	 * Must be created here in order for the modules to be initialized
	 * correctly.
	 */
	if (this.injectorSupport == null) {
		this.injectorSupport = new InjectorSupport(
			new Module[]{
				new AppTestModule(),
				new ServletTestModule()
			},
			Stage.DEVELOPMENT);
	}
	return this.injectorSupport.getInjector();
}
 
开发者ID:eurekaclinical,项目名称:eureka,代码行数:18,代码来源:ContextTestListener.java

示例4: currentStage

@Override
public Stage currentStage() {
    switch (delegate.currentStage()) {
    case DEVELOPMENT:
        return Stage.DEVELOPMENT;
    case PRODUCTION:
        return Stage.PRODUCTION;
    default:
        throw new UnsupportedOperationException();
    }
}
 
开发者ID:ruediste,项目名称:salta,代码行数:11,代码来源:BinderImpl.java

示例5: stage

protected Stage stage() {
    if (System.getenv("TEST") != null || System.getenv("DEV") != null)
        return Stage.DEVELOPMENT;

    return Stage.PRODUCTION;
}
 
开发者ID:Twister915,项目名称:pl,代码行数:6,代码来源:JPl.java

示例6: initialize

/**
 * Initializes the Para core modules and allows the user to override them. Call this method first.
 *
 * @param modules a list of modules that override the main modules
 */
public static void initialize(Module... modules) {
	if (injector == null) {
		printLogo();
		try {
			logger.info("--- Para.initialize() [{}] ---", Config.ENVIRONMENT);
			Stage stage = Config.IN_PRODUCTION ? Stage.PRODUCTION : Stage.DEVELOPMENT;

			List<Module> coreModules = Arrays.asList(modules);
			List<Module> externalModules = getExternalModules();

			if (coreModules.isEmpty() && externalModules.isEmpty()) {
				logger.warn("No implementing modules found. Aborting...");
				destroy();
				return;
			}

			if (!externalModules.isEmpty()) {
				injector = Guice.createInjector(stage, Modules.override(coreModules).with(externalModules));
			} else {
				injector = Guice.createInjector(stage, coreModules);
			}

			addInitListener(CoreUtils.getInstance());
			addInitListener(HealthUtils.getInstance());
			addInitListener(MetricsUtils.getInstance());

			for (InitializeListener initListener : INIT_LISTENERS) {
				if (initListener != null) {
					injectInto(initListener);
					initListener.onInitialize();
					logger.debug("Executed {}.onInitialize().", initListener.getClass().getName());
				}
			}
			// this enables the "River" feature - polls the default queue for objects and imports them into Para
			if (Config.getConfigBoolean("queue_link_enabled", false) && HealthUtils.getInstance().isHealthy()) {
				injector.getInstance(Queue.class).startPolling();
			}

			logger.info("Instance #{} initialized.", Config.WORKER_ID);
		} catch (Exception e) {
			logger.error(null, e);
		}
	}
}
 
开发者ID:Erudika,项目名称:para,代码行数:49,代码来源:Para.java


注:本文中的com.google.inject.Stage.DEVELOPMENT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。