application.yml
server:
port: 8097
servlet:
context-path: /wgjl
tomcat:
uri-encoding: UTF-8
spring:
application:
name: wgmmis
profiles:
active: @spring.profiles.active@
main:
allow-bean-definition-overriding: true
mvc:
# 静态资源访问前缀路径
static-path-pattern: /@file.fake.path@/**
resources:
# 静态资源访问路径配置
static-locations: classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:@file.physical.path@
file:
path:
fake: @file.fake.path@
physical: @file.physical.path@
application-dev.yml
这一个文件会继承上一个文件
spring:
thymeleaf:
cache: false
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.ibm.db2.jcc.DB2Driver
url: jdbc:db2://47.101.182.44:50000/mmis:currentSchema=MMIS;
username: administrator
password: Wugang123456
# Hikari 连接池配置
# 最小空闲连接数量
hikari:
minimum-idle: 5
# 空闲连接存活最大时间,默认600000(10分钟)
idle-timeout: 180000
# 连接池最大连接数,默认是10
maximum-pool-size: 10
# 此属性控制从池返回的连接的默认自动提交行为,默认值:true
auto-commit: true
# 连接池名称
pool-name: MyHikariCP
# 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
max-lifetime: 1800000
# 数据库连接超时时间,默认30秒,即30000
connection-timeout: 30000
connection-test-query: select 1 from sysibm.sysdummy1
servlet:
multipart:
enabled: true
max-file-size: 10MB
max-request-size: 200MB
mybatis-plus:
mapper-locations: classpath*:/mapper/**/*Mapper.xml
global-config:
banner: false
db-config:
id-type: input
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
pom.xml
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<spring.profiles.active>dev</spring.profiles.active>
<file.fake.path>static</file.fake.path>
<file.physical.path>D:\home\wgjl</file.physical.path>
</properties>
</profile>
<profile>
<id>test</id>
<properties>
<spring.profiles.active>test</spring.profiles.active>
<file.fake.path>static</file.fake.path>
<file.physical.path>D:\home\wgjl</file.physical.path>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<spring.profiles.active>prod</spring.profiles.active>
<file.fake.path>static</file.fake.path>
<file.physical.path>/data/wg/jl</file.physical.path>
</properties>
</profile>
</profiles>
mvn clean package -P dev
用 application-dev.properties 可能会更好
评论区