简体   繁体   中英

I need to set active profile in spring boot app though maven command but its taking default profile

I have 3 environments in my application ie dev, prod, test i for that i separate files like application-prod.yml,application-dev.yml,applicaton-test.yml and also application.properties i am running command -> mvn spring-boot:run -Dspring.profiles.active=prod but its taking profile as a default profile

application.properties

server.port=8002

application-prod.yml
--------------------------
spring:
  jpa:
    show-sql: true
    properties:
      hibernate: dialect:org.hibernate.dialect.Oracle10gDialect
      ddl-auto: update

  datasource:
    username: scott
    password: tiger
    url: jdbc:oracle:thin:@localhost:1521:xe
    driver-class-name: oracle.jdbc.OracleDriver

  app:
    message : This for DevEnvironment connect to Oracle

logging:
  level:
    org:
      springframework:
        web: DEBUG

If you are using maven command then try the following to set the profile :

mvn spring-boot:run -Dspring-boot.run.profiles=foo,bar

The above command sets the run time spring profile through the maven plugin. Official doc .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM