I have a model class which corresponds to a mongo document:
@Document(collection="GRADE_KN")
public class Grade {
@Id
private String id;
private String name;
...
}
As you can see, I have hard coded document name as "GRADE_KN". I wanted to move this to property file.
For example:
In application.properties:
mongo.collection.name=GRADE_KN
Generally, we use @Value
annotation to access property. But it doesn't seem to work in this case.
But how to access property with @Document
annotation.
Please clarify.