springBoot yaml/properties 文件配置参数解析
2019-04-04 14:25
405 查看
在spring boot项目中可以使用俩种 配置文件 一中是 .yaml 结尾的 一种是 .properties 结尾的
Spring Boot 在启动时,就会从 application中读取配置信息,并加载到内存中。以下是配置文件的一些参数解析:
配置项 | 说明 | 举例 |
---|---|---|
server.port | 应用程序启动端口 | server.port=8080,定义应用程序启动端口为 8080 |
server.servlet.context-path | 应用程序上下文 | server.servlet.context-path=/api,则访问地址为:http://ip:port/api |
spring.servlet.multipart.maxFileSize | 最大文件上传大小,-1为不限制 | spring.servlet.multipart.maxFileSize=-1 |
spring.jpa.database | 数据库类型 | spring.jpa.database=MYSQL,指定数据库为mysql |
spring.jpa.properties.hibernate.dialect | hql方言 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect |
spring.datasource.url | 数据库连接字符串 | spring.datasource.url=jdbc:mysql://localhost:3306/database?useUnicode=true&characterEncoding=UTF-8&useSSL=true |
spring.datasource.username | 数据库用户名 | spring.datasource.username=root |
spring.datasource.password | 数据库密码 | spring.datasource.password=root |
spring.datasource.driverClassName | 数据库驱动 | spring.datasource.driverClassName=com.mysql.jdbc.Driver |
spring.jpa.showSql | 控制台是否打印 SQL 语句 | spring.jpa.showSql=true |
相关文章推荐
- springboot读取XXX.properties自定义配置文件中的map和list类型配置参数
- Spring Boot-配置文件详解:Properties和YAML
- springboot如何读取配置文件中的参数(例如:application-consts.properties) 又结合maven读取配置文件的顺序
- Spring Boot -- 配置文件详解:Properties 和 YAML
- springboot @value("${sj.name}") 或者@ConfigurationProperties("jwt.config") 配置文件参数读取
- Spring Boot为我们准备了最佳的数据库连接池方案,只需要在属性文件(例如application.properties)中配置需要的连接池参数即可。
- YAML/Properties配置文件与Spring Boot(转)
- Spring Boot 配置文件详解:Properties和YAML
- (三)SpringBoot之配置文件详解:Properties和YAML
- 【spring boot】配置文件 application.properties 属性解析
- Spring Boot基础3-配置文件详解:Properties和YAML
- Spring Boot 配置文件详解:Properties和YAML
- (三)SpringBoot之配置文件详解:Properties和YAML
- SpringBoot (五) :YAML和PROPERTIES配置文件详解_一点课堂(多岸学院)
- SpringBoot中自定义properties文件配置参数并带有输入提示
- spring boot application.properties文件外部配置
- [Spring boot]配置文件properties加载
- Springboot学习笔记之读取全局配置文件参数
- spring 配置文件中datasource 从properties文件中获取mysql数据库连接参数遇到的问题
- Spring boot application.properties文件的配置总结(全)