You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
1. 외부 설정
2. 외부 설정 방법 4가지
OS 전체에서 접근 가능 (System.getenv())
JVM 내부에서 접근 가능 (System.getProperty(key))
실행 시 -Dkey=value로 전달
main(String[] args)로 전달 (직접 파싱 필요)
application.properties 또는 application.yml
파일 내용으로 다수의 설정값 관리
3. 커멘드 라인 옵션 인수
java -jar app.jar --url=devdb --username=dev_user
4. 스프링 외부 설정 통합
외부 설정을 일관되게 읽을 수 있도록 추상화
OS 환경 변수, 시스템 속성, 커맨드 라인, 설정 파일 등 모두 environment.getProperty(key)로 조회 가능
외부 설정을 읽는 각 구현체 (SystemEnvironmentPropertySource, CommandLinePropertySource 등)
5. 설정 파일
6. 프로필
7. 외부 설정을 읽는 방법
String url = env.getProperty("my.datasource.url");
@value("${my.datasource.url}")
private String url;
@ConfigurationProperties("my.datasource")
public class MyDataSourceProperties { ... }
8. 설정 검증
@notempty
private String url;
@min(1) @max(999)
private int maxConnection;
9. 우선순위
Beta Was this translation helpful? Give feedback.
All reactions