title: ConfigMap is not working well with application.properties but works well with application.yml
body: <p>New to k8s.</p>
  
  <p>Went through <a href="https://cloud.spring.io/spring-cloud-static/spring-cloud-kubernetes/2.1.0.RC1/multi/multi__kubernetes_propertysource_implementations.html" rel="nofollow noreferrer">https://cloud.spring.io/spring-cloud-static/spring-cloud-kubernetes/2.1.0.RC1/multi/multi__kubernetes_propertysource_implementations.html</a></p>
  
  <p>I am having multi profiles in config map and want my app to pickup the properties based on the spring.profiles.active.</p>
  
  <p><strong>Case 1:-</strong></p>
  
  <p>My ConfigMap looks like,</p>
  
  <pre><code>kind: ConfigMap
  apiVersion: v1
  metadata:
    name: example-configmap-overriding-new-02
  data:
    application.properties: |-
      globalkey = global key value
      TeamName = Team Name value
      Purpose = Purpose value
      RootFile = Root file value
      Company = company value
      Place = Place value
      Country = Country value
      ---
      spring.profiles = qa
      globalkey = global key qa value
      TeamName = Team Name qa value
      Purpose = Purpose qa value
      RootFile = Root file qa value
      ---
      spring.profiles = prod
      globalkey = global key prod value
      Company = company prod value
      Place = Place prod value
      Country = Country prod value
  </code></pre>
  
  <p>My deployment file looks like,</p>
  
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata: 
    name: demo-configmapsingleprofile
  spec:  
    selector:
      matchLabels:
        app: demo-configmapsingleprofile
    replicas: 1
    template: 
      metadata:
        labels:
          app: demo-configmapsingleprofile
      spec:
        serviceAccountName: config-reader
        containers:
        - name: demo-configmapsingleprofile
          image: image name
          ports:
          - containerPort: 8080
          envFrom:
            - configMapRef:
                name: example-configmap-overriding-new-02
          securityContext:
              privileged: false        
  </code></pre>
  
  <p>My Config file in spring boot looks like,</p>
  
  <pre><code>@Configuration
  public class ConfigConsumerConfig {
  
  @Value(value = "${globalkey}")
  private String globalkey;
  
  @Value(value = "${TeamName}")
  private String teamName;
  
  @Value(value = "${Purpose}")
  private String purpose;
  
  @Value("${RootFile}")
  private String rootFile;
  
  @Value("${Company}")
  private String company;
  
  @Value("${Place}")
  private String place;
  
  @Value("${Country}")
  private String country;
  
  //With getters and setters
  }
  </code></pre>
  
  <p>My application.properties looks like,</p>
  
  <pre><code>spring.profiles.active=prod
  spring.application.name=example-configmap-overriding-new-02
  spring.cloud.kubernetes.config.name=example-configmap-overriding-new-02
  spring.cloud.kubernetes.config.namespace=default
  spring.cloud.kubernetes.config.sources[0].name=example-configmap-overriding-new-02
  spring.cloud.kubernetes.config.enabled=true
  </code></pre>
  
  <p><strong>App is starting fine and it grabbed the values from the config map. But it is picking from wrong profile. Some values are picked up from qa profile.</strong> </p>
  
  <p>I am getting the final result as:-</p>
  
  <pre><code>{"globalkey":"global key prod value","teamName":"Team Name qa value","purpose":"Purpose qa value","rootFile":"Root file qa value","company":"company prod value","place":"Place prod value","country":"Country prod value"}
  </code></pre>
  
  <p><strong>Case 2:-</strong></p>
  
  <p>But, when I used the config map with yaml, as given below,</p>
  
  <pre><code>kind: ConfigMap
  apiVersion: v1
  metadata:
    name: example-configmap-overriding-new-02
  data:
    application.yml: |-    
      globalkey : global key value
      TeamName : Team Name value
      Purpose : Purpose value
      RootFile : Root file value
      Company : company value
      Place : Place value
      Country : Country value
      ---
      spring:
        profiles: qa
      globalkey : global key qa value
      TeamName : Team Name qa value
      Purpose : Purpose qa value
      RootFile : Root file qa value
      ---
      spring:
        profiles: prod
      globalkey : global key prod value
      Company : company prod value
      Place : Place prod value
      Country : Country prod value
  </code></pre>
  
  <p><strong>I am getting the result as expected. It picks from prod profile as expected.</strong></p>
  
  <pre><code>{"globalkey":"global key prod value","teamName":"Team Name value","purpose":"Purpose value","rootFile":"Root file value","company":"company prod value","place":"Place prod value","country":"Country prod value"}
  </code></pre>
  
  <p><strong>Case 2 is working as expected but not the Case 1.</strong></p>
  
  <p>Am I doing any mistake/misunderstanding with config map. Could some one advice here?</p>
  
  <p>Thx.</p>