using yaml in spring boot
<p>I've written a restful web service that the Post produces a Kafka message and the Get consumes from Kafka Topic. I hard coded the properties that allowed me to connect to Kafka. I want to move that to a yaml file in src/main/resources</p>

<pre><code>producer:
  bootstrap.servers: "localhost:9092"
  acks: "all"
  retries: 0
  batch.size: 16384
  linger.ms: 1
  buffer.memory: 33554432
  key.serializer: "org.apache.kafka.common.serialization.StringSerializer"
  value.serializer: "org.apache.kafka.common.serialization.StringSerializer"
</code></pre>

<p>I then attempt to get this in my Kafka Producer Code</p>

<pre><code>@Service
public class SonicRestKafkaProducer {
    @Value("${producer.bootstrap.servers}")
    String bootStrapServers;

public void buildProducer() {
        Properties props = new Properties();
        if (bootStrapServers == null) {System.out.println("bootStrapServers is null");}
        props.put("bootstrap.servers", bootStrapServers);
</code></pre>

<p>Which results in a null pointer. </p>

<pre><code>bootStrapServers is null
2016-02-15 17:09:14.941 ERROR 10846 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause

java.lang.NullPointerException: null
    at java.util.Hashtable.put(Hashtable.java:459) ~[na:1.8.0_31]
    at com.sonicdrivein.bdp.kafka.restproxy.kafka.api.SonicRestKafkaProducer.buildProducer(SonicRestKafkaProducer.java:59) ~[kafka-rest-proxy-0.1.0.jar!/:0.1.0]
</code></pre>

<p>I've tried creating a separate class. I feel like it's something simple but I'm not seeing anything in the docs or here that explains it.</p>