diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnection.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnection.java index 2a7a79183f..aca9bb7a2b 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnection.java @@ -961,14 +961,7 @@ protected RedisClusterAsyncCommands getAsyncDedicatedConnection( @SuppressWarnings("unchecked") protected StatefulConnection doGetAsyncDedicatedConnection() { - - StatefulConnection connection = getConnectionProvider().getConnection(StatefulConnection.class); - - if (customizedDatabaseIndex()) { - potentiallySelectDatabase(connection, this.dbIndex); - } - - return connection; + return getConnectionProvider().getConnection(StatefulConnection.class); } @Override diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionUnitTests.java index 612367c06c..5dd0eb13c1 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionUnitTests.java @@ -25,6 +25,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import io.lettuce.core.KeyScanCursor; @@ -188,7 +189,7 @@ void dbIndexShouldBeSetWhenObtainingConnection() { connection.getNativeConnection(); verify(asyncCommandsMock).dispatch(eq(CommandType.SELECT), any(), any()); - verify(commandsMock).select(1); + verifyNoInteractions(commandsMock); } @Test // DATAREDIS-603