我的github

  原因可能有两个,第一个是IntellijIDEA本身工具的问题。第二个便是我们导入@Service包的时候导入包错误造成的

https://blog.csdn.net/WYP123456L/article/details/122479993

MapperScan和MapperScannerConfigurer的区别:MapperScan极大简化了mybatis的使用成本,不用在每个Java接口里配置@Mapper接口,同时也不用在使用SqlSessionTemplate.getMapper(PersonDao.class)去获取代理对象了,而是直接可以通过在使用的地方通过@Autowired获取了。

https://blog.csdn.net/weixin_41175789/article/details/113998067

Mapper/Dao它里面的方法是映射sql.xml文件执行sql的接口所以没有实现,不会用加@Service这个注解去解决。

解决方法1:

@Autowired改成@Resource注解

>> @autowired和@resource注解的区别是什么?

解决方法2:

Mapper/Dao层的接口上加上@Repository注解

解决方法3:

@Autowired写成@Autowired(required=false)

posted on 2022-06-01 17:28  XiaoNiuFeiTian  阅读(105)  评论(0)    收藏  举报