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