**.properties 文件
isDebug: debug
@Value("${isDebug}")
private static String isDebug;
取值失败。 原因: spring @value DI 注入 使用的是 set 注入。
且,不能从静态的上下文中引用非静态方法
Non-static method ‘set(java.lang.String)’ cannot be referenced from a static context
解决思路
@Value("${isDebug}")
private String isDebug;
private static String str;
private void setStr(String isDebug){
str = isDebug
}
//--------------------------------------
public static String port;
@Value("${server.port}")
public void setPort(String port) {
Properties.port = port;
}