- 생성자 사용
https://codingdog.tistory.com/entry/spring-boot-constructorbinding-%EC%83%9D%EC%84%B1%EC%9E%90%EB%A1%9C-binding%EC%9D%84-%EC%8B%9C%ED%82%A8%EB%8B%A4

@ConfigurationPropertiesScan(basePackages="com.example")
@ConfigurationProperties annotation scan 설정

https://www.baeldung.com/spring-yaml-inject-map

Inject a Map from a YAML File with Spring | Baeldung

Learn how to inject a Map from a YAML file in Spring Boot.

www.baeldung.com

 
- class 안만들고 가져오기 (spring-boot-starter 2.4 부터)

@Bean
@ConfigutationProperties(prefix="logging.level")
public List<String> getList(List<String> list) {
    return new ArrayList<String>(list);
}



https://github.com/spring-projects/spring-boot/blob/2e2d1fe8d3537ddb19f6dc96ff440c33524a5ef2/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration.java#L88

- class 안만들고 가져오기 (spring-boot-starter 2.3 까지 가능)

@Bean
@ConfigutationProperties(prefix="logging.level")
public List<String> getList() {
    return new ArrayList<String>();
}


하고 사용하면 됨
간단하게 사용하기 편함
https://stackoverflow.com/questions/26699385/spring-boot-yaml-configuration-for-a-list-of-strings



Posted by 張's blog
,