I am trying to define the following property in one of my .properties files:
personExpression=${person.surname}
This is then read by a config class:
@Configuration
public class TemplateConfig {
@Autowired
private Environment environment;
public String getPersonExpression() {
return environment.getProperty("personExpression");
}
}
However this gives the exception:
java.lang.IllegalArgumentException: Could not resolve placeholder 'person.surname' in string value "${person.surname}"
Is there a way to do get getPersonExpression()
to return the string literal ${person.surname}
without attempting to resolve it?