title: deserialize optional in kotlin from string in redis
body: <p>I'm trying to deserialize an optional that I save as a string in redis, but I always return a hashmap.
  I'm instantiating my object mapper</p>
  
  <pre><code> private  var objectMapper: ObjectMapper= ObjectMapper().registerModule(KotlinModule())
          .registerModule( Jdk8Module())
  .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
  </code></pre>
  
  <p>serialize asi</p>
  
  <pre><code>  redisTemplate.opsForValue().set("key3", objectMapper.writeValueAsString(value))
  </code></pre>
  
  <p>and I am deserializo asi:</p>
  
  <pre><code>var result1 = objectMapper.readValue&lt;Optional&lt;T&gt;&gt;(valueCache!!)
  </code></pre>
  
  <p>the result is</p>
  
  <p><a href="https://i.stack.imgur.com/vmJIb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vmJIb.png" alt="enter image description here"></a></p>
  
  <p>where T is a User class</p>
  
  <p>class UserRole : Serializable {</p>
  
  <pre><code>@Id
  @GeneratedValue(strategy=GenerationType.IDENTITY)
  @Column(name = "id", updatable = false, nullable = false)
  var id: Long = 0
  
  @Min(value = 1)
  @JsonProperty("role_id")
  @JoinColumn(name = "role_id", updatable = false, nullable = false)
  var roleId: Long = 0
  </code></pre>
  
  <p>}</p>