What is the difference between a application.properties file and a application.yml file?

Source: Internet
Author: User

What is the difference between a application.properties file and a application.yml file?

The benefits of the Yml file, the natural tree structure, at a glance, is essentially the same as the properties.

Many of the official demos are configured with YML files.

Note the point:

1, the original key, such as Spring.jpa.properties.hibernate.dialect, press "." Split, all into a tree-like configuration

2,key after the colon, must follow a space

3, delete the original application.properties. Then be sure to execute the maven-x clean install

  #application. ymlserver:port:8086 spring:datasource:name:test ur L:jdbc:mysql://192.168.1.112:3306/test username:root password:xxx # using Druid data source type:com.al         Ibaba.druid.pool.DruidDataSource Driver-class-name:com.mysql.jdbc.driver Filters:stat maxactive:20 Initialsize:1 maxwait:60000 minidle:1 timebetweenevictionrunsmillis:60000 minevict        ableidletimemillis:300000 validationquery:select ' x ' testwhileidle:true testonborrow:false Testonreturn:false poolpreparedstatements:true maxopenpreparedstatements:20  
  #application. propertiesserver.port=8085spring.datasource.type= Org.apache.tomcat.jdbc.pool.datasourcespring.datasource.url=jdbc:mysql://aliyuncs.com:3306/home?useunicode= True  &zerodatetimebehavior  =converttonull &autoreconnect  =truespring.datasource.username=rootspring.datasource.password=*** spring.datasource.driver-class-name=com.mysql.jdbc.driver#mybatis.mapper-locations=classpath*:com/wanyu/fams/ mapping/*mapper.xml#mybatis.type-aliases-package=com.wanyu.fams.modelspring.mvc.view.prefix=/web-inf/jsp/ Spring.mvc.view.suffix=.jspspring.druid.datasource.type= Com.alibaba.druid.pool.druiddatasourcespring.druid.datasource.driverclassname= com.mysql.jdbc.driverspring.druid.datasource.url=jdbc:mysql://localhost:3306/spring_boot?characterencoding= Utf-8spring.druid.datasource.username=rootspring.druid.datasource.password=xxx  

What is the difference between a application.properties file and a application.yml file?

Related Article

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.