前提:已安装Redis,导入jedis.jar,commons-pool2.jar
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.4.2</version>
</dependency>
配置连接池RedisUtils.java
public class RedisUtils {
private static JedisPool jedisPool;
static {
Properties properties = new Properties();
InputStream is= RedisUtils.class.getResourceAsStream("jedis.properties");
try {
properties.load(is