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

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"})

SpringCloud启动项目报错:Consider defining a bean of type 'com.XXX.XXX.dao.UserDao' in your configuration._第1张图片

 

你可能感兴趣的:(IDEA,spring-cloud)