Reputation: 2279
Having the following code:
public class Constants {
public static final String X = "-";
}
And in another class
@Value("${some.property:Constants.X")
private String separator;
How can I achieve this? Constant property is not being loaded
Upvotes: 3
Views: 48
Reputation: 40078
You need to use the T operator with the actual package name where your Constants class is located like below
@Value("#{T(your.package.Constants).X}")
private String separator;
Upvotes: 4