MySQL 数据库
server:
port: 8080
spring:
datasource:
url: jdbc:mysql://localhost:3306/xxx?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
数据库连接池
Druid 连接池
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://192.168.100.99:3306/energy_storage_test?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
druid:
initial-size: 5
min-idle: 5
max-active: 20
max-wait: 60000
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 60000
validation-query: select 'x'
test-while-idle: true
test-on-borrow: false
test-on-return: false
pool-prepared-statements: true
max-open-prepared-statements: 20
filter:
commons-log:
connection-logger-name: stat,wall,log4j
Hikari 连接池
- springboot2.0默认集成了hikari连接池
spring:
datasource:
username: dangbo
password: dangbo
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306?auth_shiro
type: com.zaxxer.hikari.HikariDataSource
hikari:
minimum-idle: 5
maximum-pool-size: 15
auto-commit: true
idle-timeout: 30000
pool-name: DatebookHikariCP
max-lifetime: 1800000
connection-timeout: 30000
connection-test-query: SELECT 'x'
OSS 对象存储
oss:
accessKeyId: xxx
accessKeySecret: xxx
bucketName: cocochimp-img
endpoint: oss-cn-beijing.aliyuncs.com
MyBatis-plus ORM配置
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
logic-delete-field: delFlag
logic-delete-value: 1
logic-not-delete-value: 0
id-type: auto
MultipartFile 文件配置
spring:
servlet:
multipart:
max-file-size: 2MB
max-request-size: 5MB
RabbitMQ 消息队列配置
spring:
rabbitmq:
host: 127.0.0.1
port: 5672
username: guest
password: guest
listener:
concurrency: 10
max-concurrency: 20
prefetch: 5