Skip to content

Commit a18c2f8

Browse files
quaffwilkinsona
authored andcommitted
Polish PropertiesRedisConnectionDetails
See gh-43825 Signed-off-by: Yanming Zhou <[email protected]>
1 parent e295063 commit a18c2f8

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/PropertiesRedisConnectionDetails.java

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ class PropertiesRedisConnectionDetails implements RedisConnectionDetails {
3939
@Override
4040
public String getUsername() {
4141
if (this.properties.getUrl() != null) {
42-
ConnectionInfo connectionInfo = connectionInfo(this.properties.getUrl());
42+
ConnectionInfo connectionInfo = RedisConnectionConfiguration.parseUrl(this.properties.getUrl());
4343
return connectionInfo.getUsername();
4444
}
4545
return this.properties.getUsername();
@@ -48,7 +48,7 @@ public String getUsername() {
4848
@Override
4949
public String getPassword() {
5050
if (this.properties.getUrl() != null) {
51-
ConnectionInfo connectionInfo = connectionInfo(this.properties.getUrl());
51+
ConnectionInfo connectionInfo = RedisConnectionConfiguration.parseUrl(this.properties.getUrl());
5252
return connectionInfo.getPassword();
5353
}
5454
return this.properties.getPassword();
@@ -57,17 +57,13 @@ public String getPassword() {
5757
@Override
5858
public Standalone getStandalone() {
5959
if (this.properties.getUrl() != null) {
60-
ConnectionInfo connectionInfo = connectionInfo(this.properties.getUrl());
60+
ConnectionInfo connectionInfo = RedisConnectionConfiguration.parseUrl(this.properties.getUrl());
6161
return Standalone.of(connectionInfo.getUri().getHost(), connectionInfo.getUri().getPort(),
6262
this.properties.getDatabase());
6363
}
6464
return Standalone.of(this.properties.getHost(), this.properties.getPort(), this.properties.getDatabase());
6565
}
6666

67-
private ConnectionInfo connectionInfo(String url) {
68-
return (url != null) ? RedisConnectionConfiguration.parseUrl(url) : null;
69-
}
70-
7167
@Override
7268
public Sentinel getSentinel() {
7369
org.springframework.boot.autoconfigure.data.redis.RedisProperties.Sentinel sentinel = this.properties

0 commit comments

Comments
 (0)