默认被static修饰的变量通过@Value会注入失败,我们注解可以写到方法上:
private static String name;
@Value("${user.nick:如果需要默认值格式(:默认值)}")
public void setName(String name) {
this.name = name;
}
默认被static修饰的变量通过@Value会注入失败,我们注解可以写到方法上:
private static String name;
@Value("${user.nick:如果需要默认值格式(:默认值)}")
public void setName(String name) {
this.name = name;
}