在使用如下图版本 SpringBoot 时引入redis依赖,
会出现如下Maven文件报错,
解决方法:
复制以下代码替换原来的redis依赖。
org.springframework.boot spring-boot-starter-redis 1.3.8.RELEASE
创建测试类测试redis:
package com.example.springbootcondition;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
@SpringBootTest
class SpringbootConditionApplicationTests {
@Autowired
private RedisTemplate redisTemplate;
@Test
void test() {
System.out.println(redisTemplate);
}
}
输出结果如下:



