✅ 操作成功!

SpringCloud启动项目报错:Consider defining a bean of type 'com.XXX.XXX.dao.UserDao' in your confi

发布时间:2023-06-12 作者:admin 来源:文学

SpringCloud启动项目报错:Consider defining a bean of type 'com.XXX.XXX.dao.UserDao' in your confi

SpringCloud启动项目报错:Consider defining a bean of type 'com.XXX.XXX.dao.UserDao' in your confi

1.报错信息为:

Description:

Field userDao in com.XXX.XXX.service.impl.UserServiceImpl required a bean of type 'com.XXX.XXX.dao.UserDao' that could not be found.

The injection point has the following annotations:     - @org.springframework.beans.factory.annotation.Autowired(required=true)

Action:

Consider defining a bean of type 'com.XXX.XXX.dao.UserDao' in your configuration.

Process finished with exit code 1

2.在启动类上加:

@ComponentScan(basePackages = {"com.XXX.XXX.dao"})

 

👁️ 阅读量:0