把启动类改成@SpringBootApplication(scanBasePackages = {"service","dao","config”})

 

springboot 报错Field XXX required a bean of type XXX that could not be found.

个人猜测与扫描的包有关,但这只是笼统的的写法。不一定会解决问题,但会让项目跑起来不报错。

解决办法,其实还是与包有关,可直接改为具体的或顶级根包

springboot 报错Field XXX required a bean of type XXX that could not be found.

@SpringBootApplication(scanBasePackages = {"com.tianjian.web"})

或改为@SpringBootApplication(scanBasePackages ={"com.tianjian.web.service","com.tianjian.web.dao","com.tianjian.web.config”,"com.tianjian.web.propertytschedules.controller"})

相关文章:

  • 2021-05-07
  • 2021-05-05
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
  • 2021-11-18
  • 2021-12-26
猜你喜欢
  • 2021-07-01
  • 2021-11-25
  • 2021-05-25
  • 2022-01-12
  • 2022-12-23
  • 2021-05-15
  • 2021-04-02
相关资源
相似解决方案