I have multiple properties in my application.properties file
prop.a=A
prop.b=B
prop.c=C
// and more
Now i have to add the property A to the rest of them. I am doing this like following
    @Value("${prop.a}")
    private String a;
    @Value("${prop.b}")
    private String b;
    b = new StringBuffer(b).append(a).toString();
I have to individually append each string. Can i do this in the annotation? like @Value("${prop.b}" + "${prop.a}") ?
If you want to do this programmatically, you have to do this:
@Value( "${prop.a}${prop.b}" )
private String b;
You can, however, achieve this in application.properties itself this way:
prop.a=A
prop.b=${prop.a}B
prop.c=${prop.a}C
(Please note that wherever your example says prob.*,I have changed to prop.*.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With