一、引入pom
    1.引入jdbc-starter,mybatis-starter,mysql-connector

SpringBoot整合Mybaties


二、改yml
    yml的配置如下:千万注意那块儿mapper的映射路径的后缀必须是Mapper.xml
    SpringBoot整合Mybaties

三、写业务代码
  1.在springboot的启动类的上边添加扫描mapper的注解

SpringBoot整合Mybaties

    2.Mapper层------classpath:mapping/*Mapper.xml

SpringBoot整合Mybaties


3.Dao层---------com.example.demo.mapper.UserMapper

SpringBoot整合Mybaties
4.service层

SpringBoot整合Mybaties
5.controller层

SpringBoot整合Mybaties
四、测试

SpringBoot整合Mybaties

 

 

 

相关文章:

  • 2022-12-23
  • 2021-11-09
  • 2021-09-29
  • 2021-10-10
  • 2021-12-21
  • 2021-12-09
  • 2021-11-30
猜你喜欢
  • 2021-07-02
  • 2022-12-23
  • 2021-12-05
  • 2021-05-21
  • 2021-05-23
  • 2021-11-29
  • 2021-05-11
相关资源
相似解决方案