Add support for spring.redis.url property
Update `RedisAutoConfiguration` to optionally configure Redis using a `spring.redis.url` property`. Closes gh-7395
This commit is contained in:
@@ -75,6 +75,22 @@ public class RedisAutoConfigurationTests {
|
||||
.isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOverrideURLRedisConfiguration() throws Exception {
|
||||
load("spring.redis.host:foo", "spring.redis.password:xyz",
|
||||
"spring.redis.port:1000",
|
||||
"spring.redis.ssl:true",
|
||||
"spring.redis.url:redis://user:password@example:33");
|
||||
assertThat(this.context.getBean(JedisConnectionFactory.class).getHostName())
|
||||
.isEqualTo("example");
|
||||
assertThat(this.context.getBean(JedisConnectionFactory.class).getPort())
|
||||
.isEqualTo(33);
|
||||
assertThat(this.context.getBean(JedisConnectionFactory.class).getPassword())
|
||||
.isEqualTo("password");
|
||||
assertThat(this.context.getBean(JedisConnectionFactory.class).isUseSsl())
|
||||
.isEqualTo(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRedisConfigurationWithPool() throws Exception {
|
||||
load("spring.redis.host:foo", "spring.redis.pool.max-idle:1");
|
||||
|
||||
Reference in New Issue
Block a user