#35 springboot: application properties

This commit is contained in:
haerong22
2023-03-16 01:10:26 +09:00
parent 11ede7084d
commit 023d4ce0d2
4 changed files with 17 additions and 2 deletions

View File

@@ -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);
}
}

View File

@@ -0,0 +1,3 @@
url=dev.db.com
name=dev_user
password=dev_pw

View File

@@ -0,0 +1,3 @@
url=prod.db.com
name=prod_user
password=prod_pw

View File

@@ -1 +1,8 @@
testKey=local_value
#---
spring.config.activate.on-profile=dev
testKey=dev_value
#---
spring.config.activate.on-profile=prod
testKey=prod_value