i want to use a static final map<String,String>
to map a string against the default value in @Value
annotation , like:
@Value("${property1:"+ map.get(property1)+"}")
private String prop1;
But java doesnt allow using dynamic values in annotation.
If i replace map with simply a variable say, String a="propert1value"
and place this like:
@Value("${property1:"+ a+"}")
private String prop1;
It works now.
I have many property1, property2 … variables so i want to use a map instead of individual variables for holding default values.
Any solutions?
I do not know how to approach this now.
New contributor
Shivank is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
7