yaml格式:
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3308/users?seveerTimezone=GMT%2B8
username: root
password: root
properties格式:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3308/users?serverTimezone=GMT%2B8
spring.datasource.username=root
spring.datasource.password=root
注意:
加载顺序yml>properties,优先级properties>yml,properties会覆盖yml
加载顺序和优先级是相反的,正常的加载顺序是yml>properties,但是由于后加载的会覆盖先加载的,所以当两种文件都有的时候我们看到的是properties的执行了和yml的被覆盖了,所以优先级是properties>yml