package com.restfiddle.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
/**
* Created by santoshm1 on 04/06/14.
*
* Adds support for runtime property files. Run with -Dspring.profiles.active={production,default,development,test} defaults to development.
*
*/
@Configuration
@PropertySource(value={"classpath:common.properties"})
public class PropertyConfig {
public PropertyConfig() {}
@Bean
public static PropertySourcesPlaceholderConfigurer myPropertySourcesPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
/**
* Properties to support the 'production' mode of operation.
*/
@Configuration
@Profile("production")
@PropertySource(value={"classpath:env-production.properties"})
static class Production {
// Define additional beans for this profile here
}
/**
* Properties to support the 'test' mode of operation.
*/
@Configuration
@Profile({ "devlopment", "default" })
@PropertySource(value={"classpath:env-development.properties"})
static class Dev {
}
/**
* Properties to support the 'test' mode of operation.
*/
@Configuration
@Profile("test")
@PropertySource(value={"classpath:env-test.properties"})
static class Test {
}
}
《Springboot极简教程》SpringBoot配置文件PropertySourcesPlaceholderConfigurer
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- APPLICATION FAILED TO START Description: Parameter 0 of c...
- 首先,这个出错页面是SpringBoot的一个默认出错页面。源码在:org.springframework.boo...
- https://blog.csdn.net/forezp/article/details/70341818本文出自...
- RESTFeel RESTFeel: 一个企业级的API管理&测试平台。RESTFeel帮助你设计、开发、测试您的...
- http://docs.spring.io/spring-boot/docs/current/reference/...