[Spring] @PropertySource yaml 파일 Load 하는 방법


[Spring] @PropertySource yaml 파일 Load 하는 방법

c 서론 제가 느끼기엔 properties 보다는 yaml 파일이 더 가독성이 좋아 관리하기 쉽다고 생각합니다. 설정 파일을 불러와 객체를 만들 때 보통 @PropertySource 애노테이션을 사용하지만, default로 yaml을 읽지 못합니다. 그렇다고, yaml과 properties를 같이 사용하는 건 통일성이 없고, 그럴 필요가 없다 생각됩니다. 그렇기 때문에 이를 yaml 파일을 읽을 수 있도록 설정한 방법을 정리해봅니다. 본론 가져올 yml 파일의 설정 값입니다. @Getter @RequiredArgsConstructor @ConstructorBinding @ConfigurationProperties(value = "jwt") @PropertySource(value = "classpath..


원문링크 : [Spring] @PropertySource yaml 파일 Load 하는 방법