'Access java variable in application.properties

Is there a way to set value from java class to application.properties

For Example

// Constants.java
public interface Constants {
    String APP_NAME = "demo_app";
}
# application.properties
app.name=${Constants.APP_NAME}

obviously above example of application.properties will not work. But I want to access a constant variable's value from java class into application.properties.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source