Springboot Introductory Article--some things about the properties and yml two configuration files

Source: Internet
Author: User

We use Springboot this framework when you must use or have seen application.properties or APPLICATION.YML, can not live by someone will ask these two documents in the end what is the case, in fact, these two are springboot left the configuration text Can be configured, let's talk about some of the differences between the two of them.

First of all, we should be the most concerned about the format of the problem, two files in the configuration when the format is the same? The properties file must be a key in the configuration---value, the explanation for this is that a complete explanation of a given electrical configuration must be at the same level, which we can see as shown:

  

Then let's take a look at how we should configure the same effect in the Yml file:

  

The format we can observe is that the Yml file is a cascade presentation, and we should pay attention to several aspects:

1> in the properties file "." The connection in the Yml file is all replaced with ":" To connect, and each level must be wrapped, at the beginning of the second level should be a TAB key indentation, of course, if the sibling does not need to indent

2> in the Yml file if you need to assign a value, you must do a space bar indent after ":".

3> in the Yml file all the configuration, the same level can only appear once, for example, we use the spring level, then we are in the back of the spring level configuration must be done in this place, cannot write a spring level

  

Springboot Introductory Article--some things about the properties and yml two configuration files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.