application.properties 文件和 application.yml 文件的区别
yml文件的好处,天然的树状结构,方便查看,最终会转成application.properties
注意点:
1,原有的key,例如spring.jpa.properties.hibernate.dialect,按“.”分割,都变成树状的配置
2,key后面的冒号,后面一定要跟一个空格
3,把原有的application.properties删掉。然后一定要执行一下 maven -X clean instal
#application.ymlserver:port: 8080spring:datasource:name: testurl: jdbc:mysql://127.0.0.1:3306/testusername: rootpassword: xxx# 使用druid数据源type: com.alibaba.druid.pool.DruidDataSourcedriver-class-name: com.mysql.jdbc.Driverfilters: statmaxActive: 20initialSize: 1maxWait: 60000minIdle: 1timeBetweenEvictionRunsMillis: 60000minEvictableIdleTimeMillis: 300000validationQuery: select 'x'testWhileIdle: truetestOnBorrow: falsetestOnReturn: falsepoolPreparedStatements: truemaxOpenPreparedStatements: 20