spring boot 测试用例

依赖包

复制代码
<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>5.2.5.RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-test</artifactId>
            <version>2.2.6.RELEASE</version>
            <scope>compile</scope>
        </dependency>

目录结构

复制代码
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.*;

@RunWith(SpringRunner.class)
@SpringBootTest
public class Test {

    @org.junit.Test
    public void test() {}
}
相关推荐
why技术5 分钟前
从18w到1600w播放量,我的一点思考。
java·前端·后端
间彧16 分钟前
Redis Cluster vs Sentinel模式区别
后端
间彧18 分钟前
🛡️ 构建高可用缓存架构:Redis集群与Caffeine多级缓存实战
后端
间彧19 分钟前
构建本地缓存(如Caffeine)+ 分布式缓存(如Redis集群)的二级缓存架构
后端
qq_183802871 小时前
Linux内核idr数据结构使用
linux·运维·服务器
码农-小林2 小时前
使用leaflet库加载服务器离线地图瓦片(这边以本地nginx服务器为例)
运维·服务器·nginx
噜啦噜啦嘞好2 小时前
Linux:库制作与原理
linux·运维·服务器
androidstarjack2 小时前
知乎服务器崩溃!
运维·服务器
程序猿DD2 小时前
Java 25 中的 6 个新特性解读
java·后端
稻草猫.2 小时前
文件 IO
java·笔记·后端·java-ee·idea