public void buildFromProperties(PropertySource propertySource) {
    if (propertySource == null) {
      return;
    }

    String addr = propertySource.getPropertyStringValue(PropertyConstants.PROPERTY_REDIS_ADDRESS);
    if (StringUtils.isNotBlank(addr)) {
      this.address = addr;
    }

    Integer timeout = propertySource.getPropertyIntValue(PropertyConstants.PROPERTY_REDIS_TIMEOUT);
    if (timeout != null) {
      this.timeout = timeout;
    }

    Integer maxTotal =
        propertySource.getPropertyIntValue(PropertyConstants.PROPERTY_REDIS_MAX_TOTAL);
    if (maxTotal != null) {
      this.poolConfig.setMaxTotal(maxTotal);
    }

    Integer maxIdle = propertySource.getPropertyIntValue(PropertyConstants.PROPERTY_REDIS_MAX_IDLE);
    if (maxIdle != null) {
      this.poolConfig.setMaxIdle(maxIdle);
    }

    Integer minIdle = propertySource.getPropertyIntValue(PropertyConstants.PROPERTY_REDIS_MIN_IDLE);
    if (minIdle != null) {
      this.poolConfig.setMinIdle(minIdle);
    }

    Integer maxWaitMillis =
        propertySource.getPropertyIntValue(PropertyConstants.PROPERTY_REDIS_MAX_WAIT_MILLIS);
    if (maxWaitMillis != null) {
      this.poolConfig.setMaxWaitMillis(maxWaitMillis);
    }

    Boolean testOnBorrow =
        propertySource.getPropertyBooleanValue(PropertyConstants.PROPERTY_REDIS_TEST_ON_BORROW);
    if (testOnBorrow != null) {
      this.poolConfig.setTestOnBorrow(testOnBorrow);
    }
  }
Configuration for Redis.

TODO(zheng): support redis cluster.
src/main/java/com/eudemon/ratelimiter/env/RedisConfig.java