1.对象必须使用@Autowired注入,才能正常使用@Value注解,(而不是new 的对象)
(也即要求使用@value 的类中必须被@Service 或Component注解)
2.注解属性不能为静态
3.需添加
@PropertySource(value= {“classpath:myresource.properties”})
参考:
https://blog.csdn.net/w4187402/article/details/85052960
https://www.cnblogs.com/huanghongbo/p/9098069.html