Spring “spring.profiles.include” overrides

后端 未结 5 1053
感情败类
感情败类 2021-02-01 18:47

My intention is to have two profiles in a spring boot application - development and production one. Development profile is meant just to override some variables of production pr

5条回答
  •  走了就别回头了
    2021-02-01 19:39

    We implemented the Spring active profiles in a slightly different way. Let's say the default properties file, application.yml, contains all default values which is same in both production and development environments.

    Create separate properties for production and development files named application-prd.yml and application-dev.yml respectively. These files may contain extra properties or override some of the default properties.

    During application startup, we pass the spring.profiles.active as an environment variable. For example,

    -Dspring.profiles.active=prd

    will pick up application-prd.yml along with application.yml

    or

    -Dspring.profiles.active=dev

    will pick up application-dev.yml along with application.yml

提交回复
热议问题