I am having a constants class wherein all the Constants have been defined. The values for the constants lies in my custom properties file and the property file resides in a package. I am trying to read the value in the custom property file using my Constants class.
my Constant class
package com.example.demo.properties
public interface AppConstant {
//my custom constants
String REQUEST_SUCCESS = "REQUEST_SUCCESS";
String INTERNAL_ERROR = "INTERNAL_ERROR";
String REQUEST_FAIL = "REQUEST_FAIL";
}
AppProps.properties
//values for constants in properties file
//package com.example.demo.properties
REQUEST_SUCCESS = Request was successful
INTERNAL_ERROR = Internal Error
REQUEST_FAIL = Request Failed due to error
I am trying to read the properties file using java.util.Properties. Can someone show me how the value can be read using Spring Boot annotations.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…