这种情况只需要在mapper接口上添加
@Repository
注解就可以解决这个问题,此注解是Spring的注解,将当前类注册到Spring容器中实例化为一个bean,所以@Autowired
就能找到此bean了。
解决SpringBoot中@Autowired爆红
最新推荐文章于 2025-03-18 20:34:32 发布
这种情况只需要在mapper接口上添加
@Repository
注解就可以解决这个问题,此注解是Spring的注解,将当前类注册到Spring容器中实例化为一个bean,所以@Autowired
就能找到此bean了。