application.yml
prefix:
stringProp1: propValue1
stringProp2: propValue2
intProp1: 10
listProp:
- listValue1
- listValue2
mapProp:
key1: mapValue1
key2: mapValue2
application.properties
prefix.stringProp1=propValue1
prefix.stringProp2=propValue2
prefix.intProp1=10
prefix.listProp[0]=listValue1
prefix.listProp[1]=listValue2
prefix.mapProp.key1=mapValue1
prefix.mapProp.key2=mapValue2
public class SamplePropertyLoadingTest {
@Value("${prefix.stringProp1}")
private String stringProp1;
@ConfigurationProperties(prefix = "prefix")
@Component
public class SampleProperty {
private String stringProp1;
private String stringProp2;
@Max(99)
@Min(0)
private Integer intProp1;
private List
private Map
...
}
No comments:
Post a Comment