diff --git a/src/main/java/redis/clients/jedis/Jedis.java b/src/main/java/redis/clients/jedis/Jedis.java index 750eccf553..b6148189a8 100644 --- a/src/main/java/redis/clients/jedis/Jedis.java +++ b/src/main/java/redis/clients/jedis/Jedis.java @@ -193,6 +193,18 @@ public Jedis(final URI uri, final int connectionTimeout, final int soTimeout, .hostnameVerifier(hostnameVerifier).build()); } + /** + * Create a new Jedis with the provided URI and JedisClientConfig object. Note that all fields + * that can be parsed from the URI will be used instead of the corresponding configuration values. This includes + * the following fields: user, password, database, protocol version, and whether to use SSL. + * + * For example, if the URI is "redis://user:password@localhost:6379/1", the user and password fields will be set + * to "user" and "password" respectively, the database field will be set to 1. Those fields will be ignored + * from the JedisClientConfig object. + * + * @param uri The URI to connect to + * @param config The JedisClientConfig object to use + */ public Jedis(final URI uri, JedisClientConfig config) { if (!JedisURIHelper.isValid(uri)) { throw new InvalidURIException(String.format( diff --git a/src/main/java/redis/clients/jedis/UnifiedJedis.java b/src/main/java/redis/clients/jedis/UnifiedJedis.java index db5a52c231..f1dc895ee7 100644 --- a/src/main/java/redis/clients/jedis/UnifiedJedis.java +++ b/src/main/java/redis/clients/jedis/UnifiedJedis.java @@ -82,6 +82,18 @@ public UnifiedJedis(final URI uri) { .ssl(JedisURIHelper.isRedisSSLScheme(uri)).build()); } + /** + * Create a new UnifiedJedis with the provided URI and JedisClientConfig object. Note that all fields + * that can be parsed from the URI will be used instead of the corresponding configuration values. This includes + * the following fields: user, password, database, protocol version, and whether to use SSL. + * + * For example, if the URI is "redis://user:password@localhost:6379/1", the user and password fields will be set + * to "user" and "password" respectively, the database field will be set to 1. Those fields will be ignored + * from the JedisClientConfig object. + * + * @param uri The URI to connect to + * @param config The JedisClientConfig object to use + */ public UnifiedJedis(final URI uri, JedisClientConfig config) { this(JedisURIHelper.getHostAndPort(uri), DefaultJedisClientConfig.builder() .connectionTimeoutMillis(config.getConnectionTimeoutMillis())