美文网首页
@MapperScan注解

@MapperScan注解

作者: 覃始皇 | 来源:发表于2019-03-13 09:59 被阅读0次

说明:日常mybatis研发,需要在每个interface配置@Mapper,为了开发简便使用@MapperScan可以指定要扫描的Mapper类的包的路径

优势:避免每个interface增加注解,提升开发效率

场景:仅需加载application启动main即可

@MapperScan注解多个包

@MapperScan({"com.kfit.demo","com.kfit.user”})

参考资料:

https://blog.csdn.net/u013059432/article/details/80239075

https://blog.csdn.net/weixin_39666581/article/details/81057385

注意:包名 

 import tk.mybatis.spring.annotation.MapperScan;

@Mapper和@MapperScan实际编码时可以选其一,建议@MapperScan可以避免每个dao增加配置

相关文章

网友评论

      本文标题:@MapperScan注解

      本文链接:https://www.haomeiwen.com/subject/qpzapqtx.html