Spring-Boot配置不同环境的yml配置文件
spring-boot
spring-projects/spring-boot: 是一个用于简化Spring应用开发的框架。适合用于需要快速开发企业级Java应用的项目。特点是可以提供自动配置、独立运行和内置的Tomcat服务器,简化Spring应用的构建和部署。
项目地址:https://gitcode.com/gh_mirrors/sp/spring-boot

·
Spring Boot项目开发部署过程中,通常会有多套环境(开发dev、测试test、预生产rc,生产pro),每套环境的配置是不同的。将所有环境共同的参数配置在同一个文件中;再将每套环境不同的参数配置在各自文件中,可以减少部署错误的概率,同时项目可读性好,也便于维护。
application.yml 配置共同的参数,并确定当前运行环境
debug: false
mybatis:
mapper-locations: classpath:mapping/*.xml
type-aliases-package: com.fhbean.springboot.mybatisdemo.model
#pagehelper分页插件
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSql
spring:
profiles:
active: dev
这里的spring.profiles.active=dev即表示,当前是dev环境;application-{profile}.yml就对应application-dev.yml,{profile}的取值可以是dev, test, rc, pro
application-dev.yml
server:
port: 8080
spring:
profiles: dev
datasource:
name: test
url: jdbc:mysql://127.0.0.1:3306/springboot?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true
username: root
password: root
# 使用druid数据源
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
filters: stat
maxActive: 20
initialSize: 1
maxWait: 60000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: select 'x'
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20




spring-projects/spring-boot: 是一个用于简化Spring应用开发的框架。适合用于需要快速开发企业级Java应用的项目。特点是可以提供自动配置、独立运行和内置的Tomcat服务器,简化Spring应用的构建和部署。
最近提交(Master分支:1 个月前 )
02b2d03a
Simplify HTTP client configuration properties by sharing common
settings for both blocking and reactive clients.
The `ClientHttpRequestFactorySettings` and `ClientHttpConnectorSettings`
have been merged to a single `HttpClientSettings` class. Properties
to configure common settings are available under:
`spring.http.clients`
Blocking and reactive settings have been moved to
`spring.http.clients.blocking` and `spring.http.clients.reactive`. With
currently only the factory/connector being configurable.
HTTP Service Client properties have also been rationalized under a
`spring.http.serviceclient.<group-name>`. Support for properties that
apply to all service clients and all Rest/Web Clients have been removed.
Support for `ApiVerionInserter` beans has also been removed in favor of
configuring the service group or builders directly.
Closes gh-47398
8 小时前
f4e8cacb - 8 小时前
更多推荐
所有评论(0)