當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。