Spring Boot正在选择配置文件名称,但从默认配置文件中选择属性值

时间:2018-05-18 06:46:51

标签: spring spring-boot

我有一个spring boot应用程序,下面是application.yml:

spring:
  profiles: qa
  datasource:
    url: "jdbc:oracle:thin:@qfxo001z.unix:1523/AXLET02Q"
    username: "axle"
    #password will be loaded from secured external file location
    driver-class-name: "oracle.jdbc.driver.OracleDriver"
  jpa:
    show-sql: true
    hibernate:
      ddl-auto: update
---
banner:
  location: "config/banner.txt"
logging:
  config: "classpath:config/log4j2-spring.xml"
spring:
  profiles:
    default: dev
  datasource:
    url: "jdbc:oracle:thin:@localhost:1521/XE"
    username: "axle"
    #password will be loaded from secured external file location
    driver-class-name: "oracle.jdbc.driver.OracleDriver"
  jpa:
    show-sql: true
    hibernate:
      ddl-auto: update
    properties:
      hibernate:
        dialect: org.hibernate.dialect.OracleDialect
db:
  password:
    propertyFilePath: "/tmp/db-password.properties"
instances: &instances
  - DAPI_0
  - DAPI_1
  - DAPI_2
  - DAPI_R1
  - CNX
chronicle:
  inputQueuePath: /tmp/${INSTANCE}/queue-v1/input
  outputQueuePath: /tmp/${INSTANCE}/queue-v1/output

当我尝试通过命令运行可执行jar时,它会选择正确的配置文件名称,但从默认配置文件中选择属性值:

java -jar client-stp-grid-publisher-SNAPSHOT.jar --spring.profile.active=qa

任何人都可以帮我理解我哪里错了吗?

0 个答案:

没有答案