yml file using an environment variable

       Spring Boot can be specified with spring.profiles.active system environment parameters, allow the system to load a different profile.
  You can add parameters to specify the desired configuration when the program starts

java -Dspring.profiles.active="dev" -jar user.jar

       Of course, we can also set the environment variable in advance good system

expoer SERVER_EVN=test

  Then the active file with yml: $ {SERVER_EVN} dynamically set of good data acquisition system. So this test when the server restart Spring Boot project can set parameters do not always go up.

  Meanwhile yml also supports $ {SERVER_EVN: dev} in such a way to set the default value, then if there is no environment variable SERVER_EVN, active will default setting is "dev".

Guess you like

Origin www.cnblogs.com/justlove/p/11366016.html