This article is a mirror article of machine translation, please click here to jump to the original article.

View: 12316|Reply: 1

[Source] Spring Boot application.yml application.properties priority

[Copy link]
Posted on 8/22/2018 9:27:09 AM | | |
application.yml application.properties priority

There is a question on stackoverflow is: Can application.properties and application.yml be mixed?


Spring Boot has done a lot of work to simplify configuration, but it's still quite complex!
There are as many as 17 external configuration methods supported, which is flexible, but flexibility means increased complexity.

Let's just talk about the priorities of the two files, application.yml and application.properties

If the application.properties file exists in your project,
Then the application.yml file is just a decoration.


Why do you say that?
I configured in the application.properties file:
server.port=8085

In the application.yml file, the following is configured:

server:

  port: 8086

Start the project, console output:

main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8085 (http)

This is fully illustrated.




Previous:JAVA to get the current system time
Next:application.properties to convert application.yml files
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com