title: Spring not overriding active profile from command line
body: <p>Here is my application.yml file:</p>
  
  <pre><code>spring:
    freemarker:
      template-loader-path: classpath:/templates
  
    datasource:
      url: jdbc:postgresql://localhost:5432/myapp
      username: postgres
      password: password
      driver-class-name: org.postgresql.Driver
  
    jpa:
      show-sql: true
      properties:
        hibernate:
          enable_lazy_load_no_trans: false
          jdbc:
            lob:
              non_contextual_creation: true
          dialect: org.hibernate.dialect.PostgreSQLDialect
      hibernate:
        ddl-auto: create-drop
  
  
  ---
  
  spring:
    profiles:
      active: development
  
  
  ---
  
  spring:
    profiles: staging
  
    jpa:
      show-sql: true
      hibernate:
        ddl-auto: update
  
  logging:
    level:
      root: DEBUG
  
  ---
  
  spring:
    profiles: production
  
    jpa:
      show-sql: false
      hibernate:
        ddl-auto: update
  </code></pre>
  
  <p>I run the application using:</p>
  
  <pre><code>java -jar application.jar -Dspring.profiles.active=staging
  </code></pre>
  
  <p>In the log, I can see that spring boot prints out:
  <strong>The following profiles are active: development</strong></p>
  
  <p>So why isn't the active profile set to <em>staging</em> even though I explicitly set it in the command line args?</p>