潘志宝
2024-11-21 70079bd0772207e88414176f5ca9edb3dd4bd236
提交 | 用户 | 时间
e7c126 1 package com.iailab.framework.test.core.ut;
H 2
3 import com.iailab.framework.redis.config.IailabRedisAutoConfiguration;
4 import com.iailab.framework.test.config.RedisTestConfiguration;
5 import org.redisson.spring.starter.RedissonAutoConfiguration;
6 import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
7 import org.springframework.boot.test.context.SpringBootTest;
8 import org.springframework.context.annotation.Import;
9 import org.springframework.test.context.ActiveProfiles;
10
11 /**
12  * 依赖内存 Redis 的单元测试
13  *
14  * 相比 {@link BaseDbUnitTest} 来说,从内存 DB 改成了内存 Redis
15  *
16  * @author iailab
17  */
18 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseRedisUnitTest.Application.class)
19 @ActiveProfiles("unit-test") // 设置使用 application-unit-test 配置文件
20 public class BaseRedisUnitTest {
21
22     @Import({
23             // Redis 配置类
24             RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer
25             RedisAutoConfiguration.class, // Spring Redis 自动配置类
26             IailabRedisAutoConfiguration.class, // 自己的 Redis 配置类
27             RedissonAutoConfiguration.class, // Redisson 自动配置类
28     })
29     public static class Application {
30     }
31
32 }