首页 > 其他分享 >SpringBoot整合其他框架

SpringBoot整合其他框架

时间:2022-09-28 22:55:22浏览次数:48  
标签:整合 框架 测试 注解 编写 搭建 SpringBoot

SpringBoot整合Junit

实现步骤

  1. 搭建SpringBoot工程
  2. 引入starter-test起步依赖
  3. 编写测试类
  4. 添加测试相关注解
    • @RunWith(SpringRunner.class)
    • @SpringBootTest(classes=启动类.class)
  5. 编写测试方法

SpringBoot整合Redis(跳过)

实现步骤

  1. 搭建SpringBoot工程
  2. 引入redis起步依赖
  3. 配置redis相关属性
  4. 注入RedisTemplate模板
  5. 编写测试方法,测试

SpringBoot整合MyBatis

实现步骤

  1. 搭建SpringBoot工程
  2. 引入mybatis起步依赖,添加mysql驱动
  3. 编写DataSource和MyBatis相关配置
  4. 定义表和实体类
  5. 编写dao和mapper文件/纯注解开发
  6. 测试

image

image

注解版

image

XML配置版

image
image
image

测试

image

标签:整合,框架,测试,注解,编写,搭建,SpringBoot
From: https://www.cnblogs.com/ljmskipper/p/16739475.html

相关文章