I have configuration with
my-class
prop1: val1
prop2: val2
And the class
MyClass {
@Value("${my-class.prop1}")
private String strProp1;
@Value("${my-class.prop2}")
private String strProp2;
}
Can I use some class level property so I only need write
// @Value("${my-class}")
MyClass {
@Value("${prop1}")
private String strProp1;
@Value("${prop2}")
private String strProp2;
}
Bonus question (not what I’m looking for, but on same subject): How do I drop the @Value
annotation altogether if the name of the member equals the name of the configuration property?