title: Kafka ErrorHandlingDeserializer2 config values in application.properties
body: <p>I want to set Kafka ErrorHandlingDeserializer2 config values in application.properties using spring boot auto config instead of defining them in code like below:</p>
  
  <pre><code>... // other props
  props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ErrorHandlingDeserializer.class);
  props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, ErrorHandlingDeserializer.class);
  props.put(ErrorHandlingDeserializer.KEY_DESERIALIZER_CLASS, JsonDeserializer.class);
  props.put(JsonDeserializer.KEY_DEFAULT_TYPE, "com.example.MyKey")
  props.put(ErrorHandlingDeserializer.VALUE_DESERIALIZER_CLASS, JsonDeserializer.class.getName());
  props.put(JsonDeserializer.VALUE_DEFAULT_TYPE, "com.example.MyValue")
  props.put(JsonDeserializer.TRUSTED_PACKAGES, "com.example")
  return new DefaultKafkaConsumerFactory&lt;&gt;(props); 
  </code></pre>
  
  <p>What I am doing is setting config values like below in application.properties trying to use spring boot auto config:</p>
  
  <pre><code>spring.kafka.consumer.key-deserializer=org.springframework.kafka.support.serializer.ErrorHandlingDeserializer2
  spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.ErrorHandlingDeserializer2
  spring.deserializer.key.delegate.class=org.springframework.kafka.support.serializer.JsonDeserializer
  spring.deserializer.value.delegate.class=org.springframework.kafka.support.serializer.JsonDeserializer
  </code></pre>
  
  <p>But I am getting below errors:</p>
  
  <pre><code>ConsumerConfig values: 
      auto.commit.interval.ms = 5000
      auto.offset.reset = latest
      bootstrap.servers = [abc1.xyz.def.dev:9092, abc2.xyz.def.dev:9092, abc3.xyz.def.dev:9092]
      check.crcs = true
      client.id = 
      connections.max.idle.ms = 540000
      default.api.timeout.ms = 60000
      enable.auto.commit = true
      exclude.internal.topics = true
      fetch.max.bytes = 52428800
      fetch.max.wait.ms = 500
      fetch.min.bytes = 1
      group.id = XYZ-CONSUMER
      heartbeat.interval.ms = 3000
      interceptor.classes = []
      internal.leave.group.on.close = true
      isolation.level = read_uncommitted
      key.deserializer = class org.springframework.kafka.support.serializer.ErrorHandlingDeserializer2
      max.partition.fetch.bytes = 1048576
      max.poll.interval.ms = 300000
      max.poll.records = 500
      metadata.max.age.ms = 300000
      metric.reporters = []
      metrics.num.samples = 2
      metrics.recording.level = INFO
      metrics.sample.window.ms = 30000
      partition.assignment.strategy = [class org.apache.kafka.clients.consumer.RangeAssignor]
      receive.buffer.bytes = 65536
      reconnect.backoff.max.ms = 1000
      reconnect.backoff.ms = 50
      request.timeout.ms = 30000
      retry.backoff.ms = 100
      sasl.client.callback.handler.class = null
      sasl.jaas.config = null
      sasl.kerberos.kinit.cmd = /usr/bin/kinit
      sasl.kerberos.min.time.before.relogin = 60000
      sasl.kerberos.service.name = null
      sasl.kerberos.ticket.renew.jitter = 0.05
      sasl.kerberos.ticket.renew.window.factor = 0.8
      sasl.login.callback.handler.class = null
      sasl.login.class = null
      sasl.login.refresh.buffer.seconds = 300
      sasl.login.refresh.min.period.seconds = 60
      sasl.login.refresh.window.factor = 0.8
      sasl.login.refresh.window.jitter = 0.05
      sasl.mechanism = GSSAPI
      security.protocol = PLAINTEXT
      send.buffer.bytes = 131072
      session.timeout.ms = 10000
      ssl.cipher.suites = null
      ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1]
      ssl.endpoint.identification.algorithm = https
      ssl.key.password = null
      ssl.keymanager.algorithm = SunX509
      ssl.keystore.location = null
      ssl.keystore.password = null
      ssl.keystore.type = JKS
      ssl.protocol = TLS
      ssl.provider = null
      ssl.secure.random.implementation = null
      ssl.trustmanager.algorithm = PKIX
      ssl.truststore.location = null
      ssl.truststore.password = null
      ssl.truststore.type = JKS
      value.deserializer = class org.springframework.kafka.support.serializer.ErrorHandlingDeserializer2
  
  2019-11-20 00:40:01.630 ERROR [-,,,] 16013 --- [  restartedMain] org.apache.kafka.clients.ClientUtils     : Failed to close consumer key deserializer
  
  java.lang.NullPointerException: null
      at org.springframework.kafka.support.serializer.ErrorHandlingDeserializer2.close(ErrorHandlingDeserializer2.java:199) ~[spring-kafka-2.2.7.RELEASE.jar:2.2.7.RELEASE]
      at org.apache.kafka.clients.ClientUtils.closeQuietly(ClientUtils.java:73) ~[kafka-clients-2.0.1.jar:na]
      at org.apache.kafka.clients.consumer.KafkaConsumer.close(KafkaConsumer.java:2149) [kafka-clients-2.0.1.jar:na]
      at org.apache.kafka.clients.consumer.KafkaConsumer.&lt;init&gt;(KafkaConsumer.java:797) [kafka-clients-2.0.1.jar:na]
      at org.apache.kafka.clients.consumer.KafkaConsumer.&lt;init&gt;(KafkaConsumer.java:615) [kafka-clients-2.0.1.jar:na]
  </code></pre>
  
  <p>Note: When I try to add these config values through code, error handling is working as expected.</p>