Description
When using spring-data-redis
and RedisSerializer.java()
I noticed that a field of type OffsetTime
wasn't being serialised even though it implements Serializable
. The root cause is that SimpleTypeHolder
assumes that any class that starts with java.time
is a simple type (which in turn means CustomConversions.isSimpleType(OffsetTime.class) == true
). This breaks the assumption that CustomConversions
has a converter for the type as per the javadoc:
Returns whether the given type is considered to be simple. That means it's either a general simple type or we have a writing Converter registered for a particular type.
Expected behaviour:
customConversions.isSimpleType
returns false if there are no converters forOffsetDateTime
orOffsetTime
Actual behaviour:
customConversions.isSimpleType(OffsetDateTime.class) == true
even if there are no converters forOffsetDateTime
(and forOffsetTime
Relevant Code links:
https://github.com/spring-projects/spring-data-commons/blob/541f0ced32f3f8b2143ea5b793a489828567ff13/src/main/java/org/springframework/data/mapping/model/SimpleTypeHolder.java#L158