required a bean of type that could not be found. The injection point has the following annotations:
报错内容
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-01-04 21:28:40.430 ERROR 28092 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field userService in com.xxx.site.controller.UserController required a bean of type 'com.xxx.site.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 'com.xxx.site.service.UserService' in your configuration.
Process finished with exit code 0
原因
原因是因为我在Service接口层上面加的@Service
注解,所以报错,正确的做法是在ServiceImpl实现层加@Service
注解。