https://blog.csdn.net/qq_42274641/article/details/83107807
大意是说:通过@Component和@Value获取配置文件中的值。
如果使用new构造出的对象是获取不到值,而通过使用@Autowired或@Resource从spring容器得到的bean才可以获取到值,而不是null。
springboot @Value获取不到值的问题
最新推荐文章于 2024-07-25 22:44:17 发布
https://blog.csdn.net/qq_42274641/article/details/83107807
大意是说:通过@Component和@Value获取配置文件中的值。
如果使用new构造出的对象是获取不到值,而通过使用@Autowired或@Resource从spring容器得到的bean才可以获取到值,而不是null。