SpringBoot 2.1.12整合Mybaties与SpringMVC创建web项目入门

  1. 在POM文件中添加构建SpringBoot 2.1.12整合Mybaties与SpringMVC创建web项目入门
  2. 添加web依赖SpringBoot 2.1.12整合Mybaties与SpringMVC创建web项目入门
  3. 创建web目录结构SpringBoot 2.1.12整合Mybaties与SpringMVC创建web项目入门配置引导文件SpringBoot 2.1.12整合Mybaties与SpringMVC创建web项目入门
  4. 整合连接池,在pom文件中引用mysql驱动依赖与jdbc的启动器SpringBoot 2.1.12整合Mybaties与SpringMVC创建web项目入门springboot在jdbc启动器中继承了一个HikariCP的数据池,我们需要在application.properties中进行数据池的配置,如下SpringBoot 2.1.12整合Mybaties与SpringMVC创建web项目入门配置完成后需要在pom文件中依赖mybatis的启动器SpringBoot 2.1.12整合Mybaties与SpringMVC创建web项目入门依赖后需要对mybatis的进行配置SpringBoot 2.1.12整合Mybaties与SpringMVC创建web项目入门
  5. 整合SpringMvc
    在interceptor包中创建监听器类, 实现HanderInterceptor接口,并实现其中三个抽象方法SpringBoot 2.1.12整合Mybaties与SpringMVC创建web项目入门
    创建监听器后 需要在config包中创建SpringMvc配置类,实现WebMvcConfigure接口, 实现addInterceptor方法,添加监听器与作用域SpringBoot 2.1.12整合Mybaties与SpringMVC创建web项目入门
    6 配置通用mapper
    SpringBoot 2.1.12整合Mybaties与SpringMVC创建web项目入门
    SpringBoot 2.1.12整合Mybaties与SpringMVC创建web项目入门
    7.创建User实体类SpringBoot 2.1.12整合Mybaties与SpringMVC创建web项目入门
    接下来就是实现业务需求了