title: Spring boot kafka hello world app fails to start with "Failed to bind properties under...to..."
body: <p>I was trying basic spring boot kafka application using <a href="https://dzone.com/articles/magic-of-kafka-with-spring-boot" rel="nofollow noreferrer">this</a> tutorial.</p>
  
  <p>My project hierarchy looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/iOcMe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iOcMe.png" alt="enter image description here"></a></p>
  
  <p><strong>SpringBootKafkaApplication.java</strong></p>
  
  <pre><code>import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  
  @SpringBootApplication
  public class SpringBootKafkaApplication{
      public static void main(String[] args) {
          SpringApplication.run(SpringBootKafkaApplication.class, args);
      }
  }
  </code></pre>
  
  <p><strong>KafkaController.java</strong></p>
  
  <pre><code>import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.web.bind.annotation.PostMapping;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestParam;
  import org.springframework.web.bind.annotation.RestController;
  
  import com.temp.kafka_springboot_pocs.services.Producer;
  
  @RestController
  @RequestMapping(value = "/kafka")
  public class KafkaController {
  
      private final Producer producer;
  
      @Autowired
      public KafkaController(Producer producer) {
          this.producer = producer;
      }
  
      @PostMapping(value = "/publish")
      public void sendMessageToKafkaTopic(@RequestParam("message") String message) {
          this.producer.sendMessage(message);
      }
  }
  </code></pre>
  
  <p><strong>Consumer.java</strong></p>
  
  <pre><code>import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  import org.springframework.kafka.annotation.KafkaListener;
  import org.springframework.stereotype.Service;
  
  @Service
  public class Consumer {
  
      private final Logger logger = LoggerFactory.getLogger(Consumer.class);
  
      @KafkaListener(topics = "kafka_poc_3", groupId = "group_id")
      public void consume(String message) {
          logger.info(String.format("$$ -&gt; Consumed Message -&gt; %s", message));
      }
  }
  </code></pre>
  
  <p><strong>Producer.java</strong></p>
  
  <pre><code>import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.kafka.core.KafkaTemplate;
  import org.springframework.stereotype.Service;
  
  @Service
  public class Producer {
  
      private static final Logger logger = LoggerFactory.getLogger(Producer.class);
      private static final String TOPIC = "kafka_poc_3";
  
      @Autowired
      private KafkaTemplate&lt;String, String&gt; kafkaTemplate;
  
      public void sendMessage(String message) {
          logger.info(String.format("$$ -&gt; Producing message --&gt; %s",message));
          this.kafkaTemplate.send(TOPIC, message);
      }
  }
  </code></pre>
  
  <p><strong>application.properties</strong></p>
  
  <pre><code>spring.kafka.bootstrap-servers=localhost:9092
  
  spring.kafka.consumer.group-id=group-1
  spring.kafka.consumer.auto-offset-reset=earliest
  spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
  spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserialize
  
  spring.kafka.producer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
  spring.kafka.producer.value-deserializer=org.apache.kafka.common.serialization.StringDeserialize
  </code></pre>
  
  <p>Spring boot application is failing to start with following error description:</p>
  
  <p>Description:</p>
  
  <pre><code>Failed to bind properties under 'spring.kafka.consumer.value-deserializer' to java.lang.Class&lt;?&gt;:
  
      Property: spring.kafka.consumer.value-deserializer
      Value: org.apache.kafka.common.serialization.StringDeserialize
      Origin: class path resource [application.properties]:12:42
      Reason: No converter found capable of converting from type [java.lang.String] to type [java.lang.Class&lt;?&gt;]
  </code></pre>
  
  <p>What I am missing here? </p>
  
  <p><strong>PS:</strong> I have not worked for long in spring and spring boot. So will love someone giving me good direction / link with example or exact answer.</p>