1. The order in which the springboot project loads the configuration file
Explain as follows:
Second verification
2.1 4 configuration files
Results of the:
Conclusion: First load the application configuration file under config in the directory, and display the port number as 8084
2.2 Delete application.yml of cofnig in the root directory
The execution results are as follows:
Conclusion: Load the configuration file of application in the root directory at this time, and the port number is 8083.
2.3 Delete application.yml in the root directory
Conclusion: At this time, load the configuration file of application under config in the resouces directory, and the port number is 8082.
2.4 Delete application.yml in the resources directory
Conclusion: Load the configuration file of application in the resouces directory at this time, and the port number is 8081.
Three dynamically specify the port and context path when the jar package is executed
java -jar 13-spt-config-load-order-1.0-SNAPSHOT.jar --server.port=9092 --server.servlet.context-path=/hello
Four specify the configuration file to be loaded by the jar package
When the specified jar package is started, the configuration file loaded by the jar package is dynamically specified, and the default information overrides the information contained in the jar package itself.