在这里,我试图创建新的JedisPool,但是出现以下错误。

The constructor JedisPool(GenericObjectPool$Config, String, int, int) refers to the missing type GenericObjectPool$Config

这个程序:
package redis_openfire;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;



public class pubs {

    public static final String CHANNEL_NAME = "commonChannel";
//  private static Logger logger = LoggerFactory.getLogger(pubs.class);
    private static Jedis publisherJedis;



    public static void main(String[] args) {

        final JedisPoolConfig poolConfig = new JedisPoolConfig();

        final JedisPool jedisPool = new JedisPool(poolConfig, "localhost", 6379, 0);

        publisherJedis = jedisPool.getResource();

        publisherJedis.publish(CHANNEL_NAME, "this is...");


    }

}

最佳答案

我认为您需要在类路径中添加公共(public)池,因为JedisPool是公共(public)池支持的实现

关于redis - Jedis JedisPool提到缺少类型错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26356511/

10-10 10:57