#35 springboot: application properties
This commit is contained in:
@@ -16,10 +16,12 @@ public class EnvironmentCheck {
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
String url = env.getProperty("url");
|
||||
String username = env.getProperty("username");
|
||||
String name = env.getProperty("name");
|
||||
String password = env.getProperty("password");
|
||||
String testKey = env.getProperty("testKey");
|
||||
log.info("env url={}", url);
|
||||
log.info("env username={}", username);
|
||||
log.info("env name={}", name);
|
||||
log.info("env password={}", password);
|
||||
log.info("env testKey={}", testKey);
|
||||
}
|
||||
}
|
||||
|
||||
3
springboot/external/src/main/resources/application-dev.properties
vendored
Normal file
3
springboot/external/src/main/resources/application-dev.properties
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
url=dev.db.com
|
||||
name=dev_user
|
||||
password=dev_pw
|
||||
3
springboot/external/src/main/resources/application-prod.properties
vendored
Normal file
3
springboot/external/src/main/resources/application-prod.properties
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
url=prod.db.com
|
||||
name=prod_user
|
||||
password=prod_pw
|
||||
@@ -1 +1,8 @@
|
||||
testKey=local_value
|
||||
#---
|
||||
spring.config.activate.on-profile=dev
|
||||
testKey=dev_value
|
||||
#---
|
||||
spring.config.activate.on-profile=prod
|
||||
testKey=prod_value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user