I have a file named myProperty.properties
id.apple=20
id.banana=30
id.orange=40
name=fruit
I want to access this property in a service method using Spring's @Value annotation or ExpressionParser.
Method looks like this
public int myMethod(String fruit)
{
desiredID= "id."+fruit;
return desiredID;
}
For accessing property name I am using @Value annotation and code looks like this
@Value("${name}")
private String name;
By this I am easily able to access the property name. But how should I access the variable property id.fruiname which fruitname is passed in a method