SpringBoot @Autowired 报错,提示Consider defining a bean of type 'XX'in your configuration.

迷南。 2022-05-18 06:43 238阅读 0赞

70

主要是没有扫描到需要注入的包

解决方案


  1. DemoApplication中加上要扫描的包
  2. @ComponentScan("com.xxx.service")

发表评论

表情:
评论列表 (有 0 条评论,238人围观)

还没有评论,来说两句吧...

相关阅读