1. Configuration style

Convert from application.properties to application.yml

Does not change the function effect, just changes the display style, as follows:

server:

port: 8899

servlet:

context-path: /

2, multi-environment configuration, convenient dynamic switching

Write multiple configurations for different environments, application-develop.yml and application-producer.yml

Write the following code in the main configuration (application.yml) to implement the environment selection

spring:

profiles:

active: develop

3. How can logs also support multi-environment switching?

Change the default logback. XML file to logback-spring. XML. 2. SpringBoot switches the log environment only when the logback-spring. XML file exists

<springProfile name=”develop”>

<property name=”LOG_HOME” value=”d://logs//dev” />

</springProfile>

<springProfile name=”producer”>

<property name=”LOG_HOME” value=”d://logs//pro” />

</springProfile>

4. Dynamically set the runtime environment when starting the JAR package

First, package, and second, run the jar package Java -jar *.jar –spring.profiles. Active =product from the command line