Here is my application.yml file:
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
I run the application using:
java -jar application.jar -Dspring.profiles.active=staging
In the log, I can see that spring boot prints out: The following profiles are active: development
So why isn't the active profile set to staging even though I explicitly set it in the command line args?
 
     
     
    