springboot集成Redis
作者:互联网
jedis(java操作的中间件)
测试连接
依赖
<dependencies>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.62</version>
</dependency>
</dependencies>
编码测试
- 连接数据库
- 操作命令
- 断开连接
import redis.clients.jedis.Jedis;
public class TestPing {
public static void main(String[] args) {
//1、new redis对象即可
Jedis jedis=new Jedis("127.0.0.1",6379);
//jedis所有指令就是我们之前所有指令
System.out.println(jedis.ping());
}
}
标签:集成,springboot,Redis,clients,redis,jedis,new,Jedis,public 来源: https://blog.csdn.net/ss977/article/details/122299904