I want a certain literal dependency of one of my classes to be compulsory. The values of the literals are stored in a .properties file.
I am declaring the literal inside the class as follows:
private String name
@Value("${company.Name}")
@Required
public void setName(String name) {
this.name = name;
}
When there is no such key-value pair in the properties file, the value injected into the literal is "${company.Name}"
instead of null
. This renders the @Required
annotation useless.
How do I impose the requirement of the literal in this situation?