Spring@Value给静态变量赋值
静态变量不可以直接赋值,需要调用set方法;
代码示例
private static String address;
@Value("${hebccc.snmp.ipAddress}")
public void setIpAddress(String ipAddress){
address = ipAddress;
LOGGER.info("初始化SNMP==============>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>ipAddress:{}",ipAddress.toString());
}