springboot常见yml配置


一、数据库相关

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: - /**

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM