SpringBoot yml基本配置+数据源配置(不包括数据源代码)

application.yml

#  Tomcat  服务配置server:server:server:
server:
  tomcat:
    uri-encoding: UTF-8
    max-threads: 1000
    min-spare-threads: 30
  port: 80
  servlet:
    context-path: /scott
#    session过期时间
    session:
      timeout: 1800s
# 访问路径 localhost/scott

  # THYMELEAF 网页静态化配置
  thymeleaf:
    # 是否启用模板缓存
    cache: false
    # 应用于模板的模板模式,参考TemplateMode 枚举
    mode: HTML5
    # 模板文件编码
    encoding: UTF-8
    # 构建URL时预先查看视图名称的前缀
    prefix: classpath:/templates/
    # 在构建URL时附加到视图名称的后缀
    suffix: .html
    # 文件解析格式
    content-type: text/html
  resources: # 指定静态资源的路径
    static-locations: classpath:/static/,classpath:/templates/
 # 默认值为 classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
  static-path-pattern: /**

spring:
  # 运行环境 dev:开发环境|test:测试环境|prod:生产环境
  profiles:
    active: dev
  # jackson
  jackson:
    time-zone: GMT+8
    date-format: yyyy-MM-dd HH:mm:ss
  servlet:
    multipart:
      max-file-size: 100MB
      max-request-size: 100MB
      enabled: true



# Mybatis
mybatis:
  #MyBatis相关自定义配置
  configLocation: classpath:mybatis.xml
  #实体类所做包
  type-aliases-package: com.auth.sp.common.entity
  #mapper.xml所在位置
  mapperLocations: classpath:mapper/*.xml

 

 

application-dev.yml

#mysql和阿里druid配置
spring:
  application:
    name: scott    #指定应用的名称建议使用小写
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
#    url: jdbc:oracle:thin:@192.168.1.98:1521:orcl
    url: jdbc:mysql://localhost:3306/authority?useSSL=false&serverTimezone=UTC
    username: root
    password: test
    driver-class-name: com.mysql.jdbc.Driver
#    driver-class-name: oracle.jdbc.driver.OracleDriver
    # 下面为连接池的补充设置,应用到上面所有数据源中
    # 初始化大小,最小,最大
    initialSize: 1
    minIdle: 3
    maxActive: 20
    # 配置获取连接等待超时的时间
    maxWait: 60000
    # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
    timeBetweenEvictionRunsMillis: 60000
    # 配置一个连接在池中最小生存的时间,单位是毫秒
    minEvictableIdleTimeMillis: 30000
    #validationQuery: select 'x'
    testWhileIdle: false
    testOnBorrow: false
    testOnReturn: false
    # 打开PSCache,并且指定每个连接上PSCache的大小
    poolPreparedStatements: true
    maxPoolPreparedStatementPerConnectionSize: 20
    # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
    filters: stat,wall,slf4j
    # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
    # 合并多个DruidDataSource的监控数据
    useGlobalDataSourceStat: true

#servlet:
#    multipart:
#      max-file-size: 4096MB
#      max-request-size: 4096MB
#      enabled: true
#  freemarker:
#    suffix: .html
#    request-context-attribute: request
#    cache: false
  devtools:
    restart:
      enabled: false
      additional-paths: src/main/java
      exclude: resources/*

cmodes:
  redis:
    open: false  # 是否开启redis缓存  true开启   false关闭
  shiro:
    redis: fslse # true表示shiro session存到redis里,需要开启redis,才会生效【分布式场景】
  reids:
    host: 127.0.0.1
    port: 6379
    password:
    database: 0
    timeout: 1000
    jedis:
      pool:
        max-active: 6000
        max-wait: 1000
        max-idle: 400

#日志打印级别
debug: false

logging:
  level:
    com.auth.sp.common: DEBUG
  file: E:/project/authority/log/authority.log
  configLocation: classpath:log4j2.xml
  • 0
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值