@RunWith(SpringRunner.class)
public class AutoconfigurationApplicationTest{
// depth가 존재하는 키값은 .으로 구분해 매핑
@Value("${property.test.name}")
private String propertyTestName;
@Value("${propertyTest}")
private String propertyTest;
@Value("${propertyTestList}")
private String[] propertyTestArray;
// 키가 없는 경우 디폴트 값이 매핑되도록 설정
@Value("${noKey:default value}")
private String defaultValue;
@Value("#{'${propertyTestList}'.split(,)}")
private List<String> propertyTestList;
assertThat(propertyTestName, is("property depth test"));
assertThat(propertyTest, is("test"));
assertThat(propertyTestArray[0], is("a"));
assertThat(propertyTestArray[1], is("b"));
assertThat(propertyTestArray[2], is("c"));
assertThat(defaultValue, is("default value"));
assertThat(propertyTestList.get(0), is("a"));
assertThat(propertyTestList.get(1), is("b"));
assertThat(propertyTestList.get(2), is("c"));