Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -39,7 +39,7 @@ class PropertiesRedisConnectionDetails implements RedisConnectionDetails {
@Override
public String getUsername() {
if (this.properties.getUrl() != null) {
ConnectionInfo connectionInfo = connectionInfo(this.properties.getUrl());
ConnectionInfo connectionInfo = RedisConnectionConfiguration.parseUrl(this.properties.getUrl());
return connectionInfo.getUsername();
}
return this.properties.getUsername();
Expand All @@ -48,7 +48,7 @@ public String getUsername() {
@Override
public String getPassword() {
if (this.properties.getUrl() != null) {
ConnectionInfo connectionInfo = connectionInfo(this.properties.getUrl());
ConnectionInfo connectionInfo = RedisConnectionConfiguration.parseUrl(this.properties.getUrl());
return connectionInfo.getPassword();
}
return this.properties.getPassword();
Expand All @@ -57,17 +57,13 @@ public String getPassword() {
@Override
public Standalone getStandalone() {
if (this.properties.getUrl() != null) {
ConnectionInfo connectionInfo = connectionInfo(this.properties.getUrl());
ConnectionInfo connectionInfo = RedisConnectionConfiguration.parseUrl(this.properties.getUrl());
return Standalone.of(connectionInfo.getUri().getHost(), connectionInfo.getUri().getPort(),
this.properties.getDatabase());
}
return Standalone.of(this.properties.getHost(), this.properties.getPort(), this.properties.getDatabase());
}

private ConnectionInfo connectionInfo(String url) {
return (url != null) ? RedisConnectionConfiguration.parseUrl(url) : null;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url is never null here.

}

@Override
public Sentinel getSentinel() {
org.springframework.boot.autoconfigure.data.redis.RedisProperties.Sentinel sentinel = this.properties
Expand Down
Loading