天天看點

Springboot3-application.yml正常配置

作者:好學麻醬zX
server:
  tomcat:
    accept-count: 100 
    threads:
      max: 400 
    max-http-form-post-size: -1
  port: 8002
  servlet:
    encoding:
      enabled: true
      charset: UTF-8
      force: true
    context-path: ""
spring:
  main:
    allow-bean-definition-overriding: true
    allow-circular-references: true
  application:
    name: tenant-service
  freemarker:
    suffix: .ftl
    content-type: text/html
    charset: UTF-8
    cache: false
    template-loader-path: classpath:/templates
    settings:
      classic_compatible: true #處理空值
      datetime_format: yyy-MM-dd HH:mm
      number_format: 0.##
      template_update_delay: 0
    check-template-location: true
    expose-request-attributes: true
    expose-session-attributes: true
    request-context-attribute: request
    allow-session-override: true
  jackson: 
    date-format: yyyy-MM-dd HH:mm:ss
    time-zone: GMT+8
  servlet:
    multipart:
      enabled: true
      max-file-size: 10737418240 # 10GB
      max-request-size: 10737418240 # 10GB
  mvc:
    format:
      date: yyyy-MM-dd
      date-time: yyyy-MM-dd HH:mm:ss
      time: HH:mm:ss
#    redis配置
  data:
    redis:
      host: 192.168.1.115
      port: 6379
      client-type: lettuce
      lettuce:
        pool:
          max-active: 8
          max-idle: 8
          min-idle: 2
          max-wait: -1ms
        shutdown-timeout: 100ms
  # 資料源配置
  datasource:
    url: jdbc:mysql://192.168.1.128:3306?serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8
    username: root
    password: 123456
    driver-class-name: com.mysql.cj.jdbc.Driver
management:
  endpoints:
    web:
      exposure:
        include: "*"
  health:
    elasticsearch:
      enabled: false 
  endpoint:
    health:
      show-details: always # 顯示具體的健康資訊
    httptrace:
      enabled: true
mybatis-plus:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # sql 語句 标準輸出
    jdbc-type-for-null: null
    call-setters-on-nulls: true
    cache-enabled: false
    # 以下配置均有預設值,可以不設定
  global-config:
    db-config:
      id-type: ASSIGN_ID 
  mapper-locations: classpath:mapper/**/*.xml # mapper xml檔案位置
pagehelper:
  helper-dialect: mysql
  reasonable: true
  support-methods-arguments: true
  page-size-zero: true
  params: count=countSql
springfox:
  documentation:
    swagger-ui:
      enabled: true
      base-url: /doc/ # 通路位址:/doc/swagger-ui/
    enabled: true
           

springboot配置檔案詳解,官方文檔:

https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html#appendix.application-properties.data

繼續閱讀