diff --git a/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java b/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java index a9e2c1874e..38fa56f671 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java +++ b/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java @@ -61,7 +61,6 @@ import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; import org.springframework.util.comparator.NullSafeComparator; @@ -109,6 +108,7 @@ * @author Greg Turnquist * @author Mark Paluch * @author Golam Mazid Sajib + * @author Zhixuan Wu * @since 1.7 */ public class MappingRedisConverter implements RedisConverter, InitializingBean { @@ -317,7 +317,7 @@ protected Object readProperty(String path, RedisData source, RedisPersistentProp return null; } - if (persistentProperty.isIdProperty() && ObjectUtils.isEmpty(path.isEmpty())) { + if (persistentProperty.isIdProperty() && !StringUtils.hasText(path.isEmpty())) { return sourceBytes != null ? fromBytes(sourceBytes, typeInformation.getType()) : source.getId(); }