问题是这样的,但我注入一个service的时候发现以下情况
然后直接运行出现以下错误
***************************
APPLICATION FAILED TO START
***************************
Description:
Field userService in com.kk.admin.controller.TableController required a bean of type 'com.kk.admin.service.impl.UserServiceImpl' 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.kk.admin.service.impl.UserServiceImpl' in your configuration.
Process finished with exit code 0
原因是因为UserServiceImpl这个bean找不到,原来是因为我忘记在service实现类上添加@Service注解了。后来添加上去便解决问题
/**
* @Author Kk
* @Date 2022/2/7 21:30
* @Description
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
}
这是个非常低级的错误,引以为戒!