今天写了个controller的方法,结果就是使用到的服务没有注入成功,为空,
springboot踩坑之controller的private方法注入service为null
debug模式下:
springboot踩坑之controller的private方法注入service为null
原因:
bean在被扫描生成代理类的时候,private方法没办法正常代理。
修改成public/protected 即可。

详细spring代理原理需要深入学习分析一下。

相关文章:

  • 2022-12-23
  • 2021-11-29
  • 2021-11-08
  • 2021-08-03
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
猜你喜欢
  • 2021-12-18
  • 2021-08-05
  • 2022-12-23
  • 2021-12-29
  • 2021-04-02
相关资源
相似解决方案