Loading

Controller中@Value获取不到配置文件中的值Springboot

尝试所有方法之后发现是,Controller中的方法定义成了private!

Controller中,private方法中的bean=null

原因:https://blog.csdn.net/q258523454/article/details/118118553
AOP无法代理private方法,Bean是通过AOP注入的,所以@Value的值为Null。

同样的,若为private方法,@Autowoired注入的值同样为null

posted @ 2022-09-29 19:09  我只有一天的回忆  阅读(192)  评论(0编辑  收藏  举报