How to inject values from yaml and set default values if a property is not defined in the yaml props file? Is using both ConfigurationProperties and Value like below a good use? If not how else can we achieve it?
Properties file
app:
prop1: test
prop2: true
map:
key1: value1
key2: value2
Java class:
@Data
@Validated
@ConfigurationProperties("app")
public class properties {
private String prop1;
@Value("${app.prop2:default}")
private Boolean prop2;
@NestedConfigurationProperty
@NotNull
private Map<String,String> prop3;
}