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:
Marco Aust
2016-11-15 19:44:34 +01:00
committed by Phillip Webb
parent 16ed59e92f
commit 90eb58252e
4 changed files with 77 additions and 4 deletions

View File

@@ -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");