diff --git a/src/main/java/org/springframework/data/redis/connection/ReactiveHashCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveHashCommands.java index 8d1140515..27877045a 100644 --- a/src/main/java/org/springframework/data/redis/connection/ReactiveHashCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/ReactiveHashCommands.java @@ -24,6 +24,7 @@ import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.function.Function; import org.reactivestreams.Publisher; import org.springframework.dao.InvalidDataAccessApiUsageException; @@ -282,7 +283,7 @@ public interface ReactiveHashCommands { * @see Redis Documentation: HGET */ default Mono hGet(ByteBuffer key, ByteBuffer field) { - return hMGet(key, Collections.singletonList(field)).map(val -> val.isEmpty() ? null : val.iterator().next()); + return hMGet(key, Collections.singletonList(field)).flatMapIterable(Function.identity()).next(); } /**