1, 错误信息
Error starting ApplicationContext. To display the conditions report
re-run your application with ‘debug’ enabled.
141611.397-[ERROR]-[]-[main]-o.s.b.d.LoggingFailureAnalysisReporter:
*************************** APPLICATION FAILED TO START
*************************** Description: Field userService in XXX.rest.UserRest required a bean of type ‘XXX.service.UserService’
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
‘cn.exiaokang.g50k.service.UserService’ in your configuration.
Disconnected from the target VM, address: ‘127.0.0.1:64723’,
transport: ‘socket’ Process finished with exit code 1
2,解决方法
在启动类上加上@MapperScan或者@ComponentScan注解,手动指定application类要扫描哪些包下的注解
@ComponentScan(basePackages = {"com.xxx.xxx.dao"})
运行: