1.yml format
Now everyone finds that configuration files are still needed in springboot. In addition to using .properties, springboot also supports yml format.
I personally think that the readability of yml format is similar to that of...properties, and sometimes it is not as regular as properties.
However, considering that many springboot projects use the yml format, it is better to put it simply, and the main purpose is to understand other people's projects.
2. The same content, different writing methods
As shown in the figure, the left is the writing method of application.properties, and the right is the writing method of application.yml. The effect they achieved is the same
3.application.yml
Notes on writing in application.yml file:
1. Different "levels" are separated by colons
2. The second level is preceded by a space, and tab characters cannot be used.
3. If there is a value after the colon, then there is at least one space between the colon and the value and cannot be closely attached to it.
In such a configuration, the access path is shown in the figure:
1. http://127.0.0.1:8888/test/hello
spring: mvc: view: prefix: /WEB-INF/jsp/ suffix: .jsp server: port: 8888 context-path: /test
4. Exclusion
Either use application.properties or application.yml , don't use both, don't torture Springboot and yourself
Summarize
The above is the method of Spring Boot using yml format introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to Wulin.com website!