title: spring MessageConversionException when deserialzing an avro object
body: <p>I am sending an avro object User and receiving it in a listener. Here are configs</p>
  
  <pre><code>@Bean
  public ProducerFactory&lt;String, User&gt; userProducerFactory() {
      Map&lt;String, Object&gt; config = new HashMap&lt;&gt;();
  
      config.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
      config.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
      config.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, AvroSerializer.class);
  
      return new DefaultKafkaProducerFactory&lt;&gt;(config);
  }
  
  @Bean
  public KafkaTemplate&lt;String, User&gt; userKafkaTemplate() {
      return new KafkaTemplate&lt;&gt;(userProducerFactory());
  }
  
  @Bean
  public Map&lt;String, Object&gt; consumerConfigs() {
      Map&lt;String, Object&gt; props = new HashMap&lt;&gt;();
      props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
      props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
      props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, AvroDeserializer.class);
      props.put(ConsumerConfig.GROUP_ID_CONFIG, "avro");
  
      return props;
  }
  
  @Bean
  public ConsumerFactory&lt;String, User&gt; consumerFactory() {
      return new DefaultKafkaConsumerFactory&lt;&gt;(consumerConfigs(), new StringDeserializer(),
              new AvroDeserializer&lt;&gt;(User.class));
  }
  
  @Bean
  public ConcurrentKafkaListenerContainerFactory&lt;String, User&gt; kafkaListenerContainerFactory() {
      ConcurrentKafkaListenerContainerFactory&lt;String, User&gt; factory
              = new ConcurrentKafkaListenerContainerFactory&lt;&gt;();
      factory.setConsumerFactory(consumerFactory());
  
      return factory;
  }
  </code></pre>
  
  <p>I am sending User like this </p>
  
  <pre><code>@Autowired
  KafkaTemplate&lt;String, User&gt; userProducer;
  public static void main(String[] args) {
      SpringApplication.run(EvaluatorApplication.class, args);
  }
  
  @Override
  public void run(String... args) throws Exception {
  
      User user = User.newBuilder()
                      .setFavoriteColor("red")
                      .setFavoriteNumber(123)
                      .setName("Shantanu")
                      .build();
  
      userProducer.send("avro.t", user);
  }
  </code></pre>
  
  <p>Here's the Kafka listener</p>
  
  <pre><code>@KafkaListener(topics = "avro.t", containerFactory = "kafkaListenerContainerFactory", groupId = "transaction-request-upstream-consumer")
  public void listenUpstream(User user)
  {
      try {
          LOGGER.info("Received {}", user);
          messageProcessor.process(null, null);
          //ack.acknowledge();
      } catch (Exception ex) {
          LOGGER.error("{}", ex);
      }
  }
  </code></pre>
  
  <p>In AvroDeserializer class message gets deserialized but then what I get is this exception. I can't make heads or tails of it. Spent a lot of time, totally unable to understand. Please help !!!</p>
  
  <pre><code>[2020-03-26 00:59:16.358] :: [ERROR] :: o.s.k.listener.LoggingErrorHandler.error.254 :: Error while processing: ConsumerRecord(topic = avro.t, partition = 0, leaderEpoch = 0, offset = 4, CreateTime = 1585164556293, serialized key size = -1, serialized value size = 17, headers = RecordHeaders(headers = [], isReadOnly = false), key = null, value = {"name": "Shantanu", "favorite_number": 123, "favorite_color": "red"})
  org.springframework.kafka.listener.ListenerExecutionFailedException: Listener method could not be invoked with the incoming message
  Endpoint handler details:
  Method [public void com.ibm.dip.evaluator.listeners.EventListener.listenUpstream(com.ibm.dip.evaluator.models.User)]
  Bean [com.ibm.dip.evaluator.listeners.EventListener@356dc38d]; nested exception is org.springframework.messaging.converter.MessageConversionException: Cannot handle message; nested exception is org.springframework.messaging.converter.MessageConversionException: Cannot convert from [com.ibm.dip.evaluator.models.User] to [com.ibm.dip.evaluator.models.User] for GenericMessage [payload={"name": "Shantanu", "favorite_number": 123, "favorite_color": "red"}, headers={kafka_offset=4, kafka_consumer=org.apache.kafka.clients.consumer.KafkaConsumer@50daf984, kafka_timestampType=CREATE_TIME, kafka_receivedMessageKey=null, kafka_receivedPartitionId=0, kafka_receivedTopic=avro.t, kafka_receivedTimestamp=1585164556293, kafka_groupId=transaction-request-upstream-consumer}], failedMessage=GenericMessage [payload={"name": "Shantanu", "favorite_number": 123, "favorite_color": "red"}, headers={kafka_offset=4, kafka_consumer=org.apache.kafka.clients.consumer.KafkaConsumer@50daf984, kafka_timestampType=CREATE_TIME, kafka_receivedMessageKey=null, kafka_receivedPartitionId=0, kafka_receivedTopic=avro.t, kafka_receivedTimestamp=1585164556293, kafka_groupId=transaction-request-upstream-consumer}]; nested exception is org.springframework.messaging.converter.MessageConversionException: Cannot handle message; nested exception is org.springframework.messaging.converter.MessageConversionException: Cannot convert from [com.ibm.dip.evaluator.models.User] to [com.ibm.dip.evaluator.models.User] for GenericMessage [payload={"name": "Shantanu", "favorite_number": 123, "favorite_color": "red"}, headers={kafka_offset=4, kafka_consumer=org.apache.kafka.clients.consumer.KafkaConsumer@50daf984, kafka_timestampType=CREATE_TIME, kafka_receivedMessageKey=null, kafka_receivedPartitionId=0, kafka_receivedTopic=avro.t, kafka_receivedTimestamp=1585164556293, kafka_groupId=transaction-request-upstream-consumer}], failedMessage=GenericMessage [payload={"name": "Shantanu", "favorite_number": 123, "favorite_color": "red"}, headers={kafka_offset=4, kafka_consumer=org.apache.kafka.clients.consumer.KafkaConsumer@50daf984, kafka_timestampType=CREATE_TIME, kafka_receivedMessageKey=null, kafka_receivedPartitionId=0, kafka_receivedTopic=avro.t, kafka_receivedTimestamp=1585164556293, kafka_groupId=transaction-request-upstream-consumer}]
      at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.decorateException(KafkaMessageListenerContainer.java:1774)
      at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeErrorHandler(KafkaMessageListenerContainer.java:1766)
      at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeRecordListener(KafkaMessageListenerContainer.java:1679)
      at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeWithRecords(KafkaMessageListenerContainer.java:1605)
      at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeRecordListener(KafkaMessageListenerContainer.java:1510)
      at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeListener(KafkaMessageListenerContainer.java:1257)
      at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.pollAndInvoke(KafkaMessageListenerContainer.java:1007)
      at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.run(KafkaMessageListenerContainer.java:927)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.lang.Thread.run(Thread.java:748)
  Caused by: org.springframework.messaging.converter.MessageConversionException: Cannot handle message; nested exception is org.springframework.messaging.converter.MessageConversionException: Cannot convert from [com.ibm.dip.evaluator.models.User] to [com.ibm.dip.evaluator.models.User] for GenericMessage [payload={"name": "Shantanu", "favorite_number": 123, "favorite_color": "red"}, headers={kafka_offset=4, kafka_consumer=org.apache.kafka.clients.consumer.KafkaConsumer@50daf984, kafka_timestampType=CREATE_TIME, kafka_receivedMessageKey=null, kafka_receivedPartitionId=0, kafka_receivedTopic=avro.t, kafka_receivedTimestamp=1585164556293, kafka_groupId=transaction-request-upstream-consumer}], failedMessage=GenericMessage [payload={"name": "Shantanu", "favorite_number": 123, "favorite_color": "red"}, headers={kafka_offset=4, kafka_consumer=org.apache.kafka.clients.consumer.KafkaConsumer@50daf984, kafka_timestampType=CREATE_TIME, kafka_receivedMessageKey=null, kafka_receivedPartitionId=0, kafka_receivedTopic=avro.t, kafka_receivedTimestamp=1585164556293, kafka_groupId=transaction-request-upstream-consumer}]
      at org.springframework.kafka.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:336)
      at org.springframework.kafka.listener.adapter.RecordMessagingMessageListenerAdapter.onMessage(RecordMessagingMessageListenerAdapter.java:86)
      at org.springframework.kafka.listener.adapter.RecordMessagingMessageListenerAdapter.onMessage(RecordMessagingMessageListenerAdapter.java:51)
      at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeOnMessage(KafkaMessageListenerContainer.java:1728)
      at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeOnMessage(KafkaMessageListenerContainer.java:1711)
      at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeRecordListener(KafkaMessageListenerContainer.java:1666)
      ... 8 common frames omitted
  Caused by: org.springframework.messaging.converter.MessageConversionException: Cannot convert from [com.ibm.dip.evaluator.models.User] to [com.ibm.dip.evaluator.models.User] for GenericMessage [payload={"name": "Shantanu", "favorite_number": 123, "favorite_color": "red"}, headers={kafka_offset=4, kafka_consumer=org.apache.kafka.clients.consumer.KafkaConsumer@50daf984, kafka_timestampType=CREATE_TIME, kafka_receivedMessageKey=null, kafka_receivedPartitionId=0, kafka_receivedTopic=avro.t, kafka_receivedTimestamp=1585164556293, kafka_groupId=transaction-request-upstream-consumer}]
      at org.springframework.messaging.handler.annotation.support.PayloadMethodArgumentResolver.resolveArgument(PayloadMethodArgumentResolver.java:145)
      at org.springframework.kafka.annotation.KafkaListenerAnnotationBeanPostProcessor$KafkaNullAwarePayloadArgumentResolver.resolveArgument(KafkaListenerAnnotationBeanPostProcessor.java:906)
      at org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:117)
      at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:148)
      at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:116)
      at org.springframework.kafka.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:48)
      at org.springframework.kafka.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:326)
      ... 13 common frames omitted
  </code></pre>