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


Java ApplicationContext.getEnvironment方法代码示例

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


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

示例1: main

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
/**
 * Main method, used to run the application.
 *
 * @param args the command line arguments
 * @throws UnknownHostException if the local host name could not be resolved into an address
 */
public static void main(String[] args) throws Exception {
	SpringApplication app = new SpringApplication(AlbedoThriftExampleServer.class);
	final ApplicationContext applicationContext = app.run(args);
	Environment env = applicationContext.getEnvironment();
	log.info("\n----------------------------------------------------------\n\t" +
					"Application '{}' is running! ",
			env.getProperty("spring.application.name"));
}
 
开发者ID:somewhereMrli,项目名称:albedo-thrift,代码行数:15,代码来源:AlbedoThriftExampleServer.java

示例2: setParent

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 * <p>The parent {@linkplain ApplicationContext#getEnvironment() environment} is
 * {@linkplain ConfigurableEnvironment#merge(ConfigurableEnvironment) merged} with
 * this (child) application context environment if the parent is non-{@code null} and
 * its environment is an instance of {@link ConfigurableEnvironment}.
 * @see ConfigurableEnvironment#merge(ConfigurableEnvironment)
 */
@Override
public void setParent(ApplicationContext parent) {
	this.parent = parent;
	if (parent != null) {
		Environment parentEnvironment = parent.getEnvironment();
		if (parentEnvironment instanceof ConfigurableEnvironment) {
			getEnvironment().merge((ConfigurableEnvironment) parentEnvironment);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:AbstractApplicationContext.java

示例3: build

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
public DefaultSuiteIdentifier build(ApplicationContext context) {
	setHostInformation();
	Environment environment = context.getEnvironment();
	return new DefaultSuiteIdentifier(UUID.randomUUID(),
		context.getStartupDate(),
		context.getDisplayName(),
		hostname,
		address,
		System.getProperty("user.name"),
		ImmutableSet.copyOf(environment.getActiveProfiles()),
		ImmutableMap.copyOf(System.getenv()));
}
 
开发者ID:qas-guru,项目名称:martini-core,代码行数:13,代码来源:DefaultSuiteIdentifier.java

示例4: main

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
/**
 * Main method, used to run the application.
 *
 * @param args the command line arguments
 * @throws UnknownHostException if the local host name could not be resolved into an address
 */
public static void main(String[] args) throws Exception {
	SpringApplication app = new SpringApplication(AlbedoThriftExampleClient.class);
	final ApplicationContext applicationContext = app.run(args);
	Environment env = applicationContext.getEnvironment();
	log.info("\n----------------------------------------------------------\n\t" +
					"Application '{}' is running! ",
			env.getProperty("spring.application.name"));
}
 
开发者ID:somewhereMrli,项目名称:albedo-thrift,代码行数:15,代码来源:AlbedoThriftExampleClient.java

示例5: init

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
protected void init(ApplicationContext applicationContext) {
    Environment env = applicationContext.getEnvironment();
    if (isCloudConsulEnabled(env) || isCloudEurekaEnabled(env) || isCloudZookeeperEnabled(env)) {
        cloudyDiscoveryEnabled.compareAndSet(false, true);
    }
}
 
开发者ID:darren-fu,项目名称:RestyPass,代码行数:7,代码来源:CloudDiscoveryServerContext.java


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