一、數據庫相關
springboot2.X默認hikaricp
server:
port:8080
spring:
datasource:
url: jdbc:mysql://localhost:3306/foodie-shop?characterEncoding=UTF-8&useSSL=false&useUnicode=true&serverTimezone=UTC
username: root
password: root
driver-class-name: com.mysql.jdbc.Driver
hikari: #spriboot默認的數據連接池 HikariCP效率最高,支持高並發
connection-timeout: 30000 #等待連接池分配連接的超時時間,超過時間還沒有分配就發生SQLException 默認30秒
minimum-idle: 5 #最小連接數
maximum-pool-size: 20 #最大連接數
auto-commit: true #自動提交
idle-timeout: 60000 #連接超時的最大時間,超時則被釋放,默認10分鍾
max-lifetime: 1800000 #連接的生命時長,超時沒有被使用則釋放,默認30分鍾
connection-test-query: select 1
pool-name: DatasourceHikariCP #連接池名稱
二、mybatis配置
#mybatis
mybatis:
type-aliases-package: com.xuxu.pojo #所有pojo類所在包的路徑
mapper-locations: classpath:mapper/*.xml #mapper映射文件
configuration:
map-underscore-to-camel-case: true #支持駝峰映射
#show mybatis logs
logging:
level:
com:
xuxu:
mapper : debug
三、熱部署
#熱部署
spring:
devtools:
restart:
enabled: true #熱部署生效
四、上傳文件
spring:
servlet:
multipart:
enabled: true
max-file-size: 30MB
max-request-size: 100MB
五、redis和shiro
spring: redis: database: 0 host: localhost port: 6379 password: jedis: pool: max-active: 8 max-wait: -1 max-idle: 8 min-idle: 0 timeout: 0 shiro: conf: domain: cookiePath: / successUrl: /index loginView: /login openToken: false sessionTimeout: 1800000 algorithmName: md5 hashIterations: 5 #不攔截的路徑 sysanon: - /login - /regist #跨域配置 allowedOrigins: - /**