一、Spring Boot配置文件基础
1.1 常用配置文件格式
Spring Boot支持两种配置文件格式:properties
和 YAML
。
1.1.1 Properties格式
application.properties
文件是最常见的配置文件格式。它以键值对的形式配置内容,格式简单直观。
server.port=8080
spring.datasource.url=jdbc:mysql://localhost:3306/mydb
1.1.2 YAML格式
application.yml
文件使用YAML格式,它通过缩进和层次结构组织配置内容,更加清晰易读,尤其是在管理复杂的嵌套配置时。
server:
port