java
개요
discounts.properties를 @PropertySource로 읽고 @Value로 주입하는 설정 메모입니다.
패키지 스캔 경로와 기본값을 함께 적어 두었습니다.
예제
@Configuration
@PropertySource("classpath:discounts.properties")
@ComponentScan("packageadress")
public class DiscountConfig {
@Value("${endofyear.discount:0}")
private double specialEndofyearDiscountField;
}
원문의 @Configration은 @Configuration의 오타로 보고 정리했습니다.