在实体类User上添加
@Component注解
Description:
Field user in com.crab.bookol.controller.UserController required a bean of type 'com.crab.bookol.entity.User' 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.crab.bookol.entity.User' in your configuration.
最后一行已经给出提示
本文介绍了如何解决在Spring框架中因未正确配置User实体类而导致的注入问题。具体步骤包括在User实体类上添加@Component注解,确保配置文件中定义了相应的bean。
938

被折叠的 条评论
为什么被折叠?



