The Spring Boot Project uses MAVEN packaging
- *.properties is placed outside the jar package to make it convenient for dynamic real-time configuration information
- *.properties is not allowed to exist inside the jar package (it is actually config that takes precedence over the configuration file in the jar package)
- Dynamically specifying the build environment and configuration files (in-Service architecture design)
Solutions
- Project Server jar package in the same directory, create a new config folder, directly nohup boot
MAVEN Package Culling *.properties
# build下配置<resources><resource><filtering>true</filtering><directory>src/main/resources/</directory><excludes><exclude>application.properties</exclude></excludes></resource></resources>#includes包含#excludes不包含#更多需要配置的可以看maven官网
Dynamically specifying the build environment and configuration files (in-Service architecture design)
# test是我的测试环境spring.profiles.active=test
- After configuring the configuration file to get outside the jar, the project will start at 8080 Port when running in idea, preferably with 1 and 2, if the project does not require that the *.properties file within the jar package be rejected, this step is not required.
The GitHub address is attached later:
Spring Boot uses MAVEN package to delete configuration files