spring.profiles.active=dev
spring.datasource.data-username=root
spring.datasource.data-password=root
在yml 文件中配置的话,写法如下:
spring:
profiles:
active: prod
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/test
username: root
password: root
yml 文件在写的时候层次感强,而且少写了代码。所以现在很多人都使用yml配置文件。