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?