title: Kafka consumer not picking mentioned Bootstrap servers
body: <p>I am trying to implement Kafka consumer with SSL, provide all the required configurations in the application.yml;</p>
  <p>When I start the spring boot Kafka consumer application; Consumer is trying to connect the localhost:9092 instead of mentioned Kafka Brokers.</p>
  <blockquote>
  <p>KafkaConfig.java</p>
  </blockquote>
  <pre><code>@Bean
      public ConsumerFactory&lt;String, AvroRecord&gt; consumerFactory() throws IOException {
          return new DefaultKafkaConsumerFactory&lt;&gt;(kafkaProps());
      }
  
      @Bean
      public KafkaListenerContainerFactory&lt;ConcurrentMessageListenerContainer&lt;String, AvroRecord&gt;&gt;
      kafkaListenerContainerFactory() throws IOException {
          ConcurrentKafkaListenerContainerFactory&lt;String, AvroRecord&gt; factory =
                  new ConcurrentKafkaListenerContainerFactory&lt;&gt;();
          factory.setConsumerFactory(consumerFactory());
          return factory;
      }
  </code></pre>
  <p><code>kafkaProps()</code> is loading all the SSL and bootstrap servers related properties. Values, I can see it in the debug mode.</p>
  <blockquote>
  <p>application.yml</p>
  </blockquote>
  <pre><code>kafka:
    properties:
      basic:
        auth:
          credentials:
            source: USER_INFO
            user: username
            pass: password
      enableAutoRegister: true
      max_count: 100
      max_delay: 5000
      schema:
        registry:
          url: https://schema-registry:8081
          ssl:
            truststore:
              location: &lt;&lt;location&gt;&gt;
              password: pwd
            keystore:
              location: &lt;&lt;location&gt;&gt;
              password: pwd
            key:
              password: pwd
      ssl:
        enabled: true
        protocols: TLSv1.2,TLSv1.1,TLSv1
        truststore:
          type: JKS
          location: &lt;&lt;location&gt;&gt;
          password: pwd
        keystore:
          type: JKS
          location: &lt;&lt;location&gt;&gt;
          password: pwd
        key:
          password: pwd
      security:
        protocol: SSL
      consumer:
        bootstrap-servers: broker1:9092,broker2:9092
        auto-offset-reset: earliest
        key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
        value-deserializer: io.confluent.kafka.serializers.KafkaAvroDeserializer
        max-message-size: 10241024
  </code></pre>
  <p>In the application logs, I am getting the below log</p>
  <pre><code>18:46:33.964 [main] INFO  o.a.k.c.a.AdminClientConfig requestId=
                      transactionKey= | AdminClientConfig values: 
      bootstrap.servers = [localhost:9092]
      client.dns.lookup = use_all_dns_ips
      client.id = 
      connections.max.idle.ms = 300000
  
  
  15:53:54.608 [kafka-admin-client-thread | adminclient-1] WARN  o.a.k.c.NetworkClient requestId=
                      transactionKey= | [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.
  </code></pre>
  <p>I am not able to find it, why it is connecting to localhost instead of mentioned brokers</p>