redis.clients.jedis.JedisShardInfo 类中的shards是个一list,为什么放入的bean就只要最后一个生效

解决方案 »

  1.   

    是循环往 list add的对象?对象要在循环中声明
      

  2.   

    有可能,还有就是各个bean的意义是一样的吗?是不是低级错误,set错了?
      

  3.   

    @BeforeClass
        public static void setUpBeforeClass() throws Exception {
            List<JedisShardInfo> shards = Arrays.asList(
                    new JedisShardInfo("localhost",6379),
                    new JedisShardInfo("localhost",6379)); //使用相同的ip:port,仅作测试
     
     
            jedis = new Jedis("localhost"); 
            sharding = new ShardedJedis(shards);
     
            pool = new ShardedJedisPool(new JedisPoolConfig(), shards);
        }
    https://blog.csdn.net/s296850101/article/details/52416043