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
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;