스프링부트 프로파일과 기본로깅

최기곤·2021년 1월 18일
0

스프링부트

목록 보기
4/4

Profile

Environment의 property인 spring.profiles.active = dev, test등으로 등록하고 @Component, @Configuration or @ConfigurationProperties에 @Profile을 마킹함으로써 환경을 세분화 할 수 있다.

그리고 MyBean이라는 인터페이스를 구현하는 @Profile("prod") ProdBean과
@Profile("dev") DevBean이 있을 때
MyBean을 실행환경 (Profile)에 따라 빈을 등록할 수 있다.
spring.profiles.active=prod로 돌리면 ProdBean등록, dev로 돌리면 DevBean등록
다만 spring.profiles.active=prod, dev로 돌리면 두개의 빈이 모두 생성된다.

SpringBootReference Documents 참조

Logging

기본으로 starters를 사용하면 Logback이 사용된다. SLF4J, Log4J2 JavaUtilLogging을 사용하더라도 잘 작동한다 이미 내부적으로 디펜던시가 적용되어 있다.

profile
놀면서 일하고 일하면서 놀고~ 해삐~

0개의 댓글