springboot配置整理

key 默认值 描述 备注
server.port 服务器HTTP端口
spring.datasource.driver-class-name 数据库驱动
spring.datasource.url 数据库连接地址
spring.datasource.username 数据库登录用户名
spring.datasource.password 数据库登录密码
spring.datasource.type Spring Boot默认的数据源是org.apache.tomcat.jdbc.pool.DataSource 连接池实现全限定名
spring.datasource.hikari 更多配置
spring.datasource.hikari.minimum-idle 与maximumPoolSize相同 最小空闲连接数
spring.datasource.hikari.maximum-pool-size 10 最大实际连接数
spring.datasource.hikari.auto-commit true 自动提交
spring.datasource.hikari.idle-timeout 600000ms,最小允许值为10000ms 连接允许空闲时长
spring.datasource.hikari.pool-name auto-generated 用户自定义连接池名称
spring.datasource.hikari.max-lifetime 1800000ms 连接生存周期
spring.datasource.hikari.connection-timeout 30000ms 连接超时时间
spring.datasource.hikari.coconnection-test-query
spring.jpa.hibernate 更多详细配置
spring.jpa.hibernate.ddl-auto ddl模式 (create, create-drop, update, validate, none)
spring.jpa.openInView true OpenEntityManagerInViewInterceptor登记。将JPA EntityManager绑定到线程,以完成请求的整个处理
spring.jpa.show-sql false 是否启用SQL语句的日志记录
spring.jpa.database-platform 要操作的目标数据库的名称
spring.resources.static-locations classpath:/META-INF/resources/, classpath:/resources/, classpath:/static/, classpath:/public/ 静态资源位置 详细解释
spring.mvc.static-path-pattern /** 访问静态资源路径
spring.thymeleaf.cache true 是否启用模板缓存
spring.thymeleaf.mode HTML 模板模式
spring.thymeleaf.encoding UTF-8 模板文件编码
spring.thymeleaf.enabled true 是否为Web框架启用Thymeleaf视图解析。
spring.thymeleaf.servlet.content-type text/html 写入HTTP响应的内容类型值
spring.thymeleaf.prefix classpath:/templates/
spring.thymeleaf.suffix .html
spring.application.name 应用程序名称
management.server.port 管理端点HTTP端口
management.endpoints.web.exposure.include health, info 应该包括或'*'的所有端点id
management.endpoints.web.base-path /actuator Web端点的基本路径
management.endpoints.web.cors.allow-credentials 是否支持凭据。 未设置时,不支持凭据。
management.endpoints.web.cors.allowed-headers 允许的请求头 以逗号分隔的请求头列表。'*'允许所有请求头。
management.endpoints.web.cors.allowed-origins 允许的请求源 允许逗号分隔的起源列表。“*”允许所有的起源。未设置时,将禁用CORS支持。
management.endpoints.web.cors.allowed-methods 允许的请求方式 允许使用逗号分隔的方法列表。'*'允许所有方法。未设置时,默认设置为GET
management.endpoints.enabled-by-default 默认情况下是否启用或禁用所有端点。
management.endpoint.health.show-details never 何时显示完整的健康信息
ribbon.eureka.enabled 在ribbon中是否使用eureka
ribbon.ReadTimeout 请求处理的超时时间
ribbon.ConnectTimeout 请求连接的超时时间
ribbon.OkToRetryOnAllOperations 是否可以为此客户端重试所有操作
ribbon.okhttp.enabled 是否使用 okhttp3.OKHttpClient
ribbon.MaxAutoRetries 同一服务器上重试的最大次数
ribbon.MaxAutoRetriesNextServer 要重试的下一个服务器的最大数目
spring.cloud.loadbalancer.retry.enabled 是否开启重试
feign.hystrix.enabled 是否启用Hystrix 功能
eureka.client.healthcheck.enabled 服务健康检查
eureka.client.registerWithEureka true 表示是否将自己注册到Eureka Server
eureka.client.fetchRegistry true 表示是否从Eureka Server获取注册信息
eureka.server.address
eureka.server.port
eureka.client.service-url.default-zone
eureka.client.enabled
eureka.client.region
eureka.client.availabilityZones
eureka.instance.preferIpAddress
eureka.instance.instanceId
eureka.instance.leaseRenewalIntervalInSeconds
eureka.instance.leaseExpirationDurationInSeconds
eureka.instance.metadataMap.zone
eureka.instance.metadata-map.XXX 自定义的元数据
eureka.instance.status-page-url-path /info 状态页面的URL,相对路径,默认使用 HTTP 访问,如果需要使用 HTTPS则需要使用绝对路径配置
hystrix 详细信息,见官方文档
hystrix.command.default.execution.isolation.thread.timeoutIntMilliseconds 1000ms 触发Hystrix服务降级处理的超时时间
hystrix.command.default.execution.timeout.enabled true 设置HystrixCommand.run()的执行是否有超时限制
hystrix.threadpool.default.coreSize 10 设置核心线程池大小
hystrix.threadpool.default.maxQueueSize -1 设置BlockingQueue最大的队列值
spring.servlet.multipart.enabled true 是否支持上传 详细信息,见官方文档
spring.servlet.multipart.file-size-threshold 0B 将文件写入磁盘的阈值
spring.servlet.multipart.location 上传文件位置
spring.servlet.multipart.max-file-size 1MB 最大文件大小
spring.servlet.multipart.max-request-size 10MB 最大请求大小
spring.servlet.multipart.resolve-lazily false 是否在文件或参数访问时惰性地解析多部分请求
multiple.ds.enabled
mybatis 详细信息,见官方文档
mybatis.config-location 指定 MyBatis 主配置文件的位置
mybatis.type-aliases-package 搜索类型别名的包
mybatis.mapper-locations Mapper xml配置文件的位置
spring.jmx.defaultDomain JMX域名
spring.profiles.active application-default.properties 定义多个配置文件(application-{profile}.properties)
spring.redis.host localhost redis服务器地址
spring.redis.port 6379 redis服务器端口
spring.redis.password redis服务器的登录密码
spring.redis.database 0 连接工厂使用的数据库索引。
spring.redis.database.jedis.pool.max-active 8 池在给定时间可以分配的最大连接数
spring.redis.jedis.pool.max-idle 8 池中“空闲”连接的最大数量
spring.redis.jedis.pool.min-idle 0 池中“空闲”连接的最小数量
spring.redis.jedis.pool.max-wait -1ms 连接分配在池耗尽时引发异常之前应阻塞的最大时间量。 使用负值来无限期阻塞
posted @ 2020-04-03 10:22  武纳尔多  阅读(447)  评论(0编辑  收藏  举报