美文网首页
SpringBoot使用MyBatis流程总结

SpringBoot使用MyBatis流程总结

作者: 李2牛 | 来源:发表于2018-06-08 15:02 被阅读0次
    1. 配置MyBatis的SpringBoot支持以及Mysql依赖(Maven/Gradle)
      MyBatis的SpringBoot支持:配置MyBatis起步依赖 1.
    2. MyBatis代码生成器(MBG)配置:插件和配置文件
    1. Mapper的xml以及接口的路径
    • xml 路径:
      application.properties里面添加两行
    mybatis.mapper-locations=  #[xml的路径]
    mybatis.type-aliases-package= #model实体文件的路径
    
    • 接口:
      两种方法
      • 在每个接口里面使用@Mapper注解
      • 在Application入口类使用@MapperScan扫描指定的包名
    1. 配置完成,开始愉快使用吧

    相关文章

      网友评论

          本文标题:SpringBoot使用MyBatis流程总结

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