218 lines
		
	
	
		
			9.2 KiB
		
	
	
	
		
			YAML
		
	
	
	
			
		
		
	
	
			218 lines
		
	
	
		
			9.2 KiB
		
	
	
	
		
			YAML
		
	
	
	
spring:
 | 
						||
  application:
 | 
						||
    name: log-server
 | 
						||
 | 
						||
  profiles:
 | 
						||
    active: smart_canteen_test
 | 
						||
 | 
						||
server:
 | 
						||
  port: 49091
 | 
						||
 | 
						||
# 日志文件配置。注意,如果 logging.file.name 不放在 bootstrap.yaml 配置文件,而是放在 application.yaml 中,会导致出现 LOG_FILE_IS_UNDEFINED 文件
 | 
						||
logging:
 | 
						||
  file:
 | 
						||
    name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
 | 
						||
 | 
						||
--- #################### 注册中心相关配置 ####################
 | 
						||
spring:
 | 
						||
  cloud:
 | 
						||
    nacos:
 | 
						||
      username: nacos
 | 
						||
      password: bonus@Admin123
 | 
						||
      server-addr: 192.168.0.244:8848
 | 
						||
      discovery:
 | 
						||
        namespace: smart_canteen # 命名空间。这里使用 dev 开发环境
 | 
						||
        metadata:
 | 
						||
          version: 1.0.0 # 服务实例的版本号,可用于灰度发布
 | 
						||
 | 
						||
--- #################### 配置中心相关配置 ####################
 | 
						||
spring:
 | 
						||
  cloud:
 | 
						||
    nacos:
 | 
						||
      # Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
 | 
						||
      config:
 | 
						||
        server-addr: 192.168.0.244:8848 # Nacos 服务器地址
 | 
						||
        namespace: smart_canteen # 命名空间 dev 的ID,不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev,这里使用 dev 开发环境
 | 
						||
        group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
 | 
						||
        name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId,默认为 spring.application.name
 | 
						||
        file-extension: yaml # 使用的 Nacos 配置集的 dataId 的文件拓展名,同时也是 Nacos 配置集的配置格式,默认为 properties
 | 
						||
 | 
						||
		
 | 
						||
spring:
 | 
						||
  main:
 | 
						||
    allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
 | 
						||
    allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如说 Feign 等会存在重复定义的服务
 | 
						||
 | 
						||
  mvc:
 | 
						||
    pathmatch:
 | 
						||
      matching-strategy: ANT_PATH_MATCHER # 解决 SpringFox 与 SpringBoot 2.6.x 不兼容的问题,参见 SpringFoxHandlerProviderBeanPostProcessor 类
 | 
						||
 | 
						||
  # Jackson 配置项
 | 
						||
  jackson:
 | 
						||
    serialization:
 | 
						||
      write-dates-as-timestamps: true # 设置 LocalDateTime 的格式,使用时间戳
 | 
						||
      write-date-timestamps-as-nanoseconds: false # 设置不使用 nanoseconds 的格式。例如说 1611460870.401,而是直接 1611460870401
 | 
						||
      write-durations-as-timestamps: true # 设置 Duration 的格式,使用时间戳
 | 
						||
      fail-on-empty-beans: false # 允许序列化无属性的 Bean
 | 
						||
 | 
						||
  # Cache 配置项
 | 
						||
  cache:
 | 
						||
    type: REDIS
 | 
						||
    redis:
 | 
						||
      time-to-live: 1h # 设置过期时间为 1 小时
 | 
						||
 | 
						||
--- #################### 接口文档配置 ####################
 | 
						||
 | 
						||
springdoc:
 | 
						||
  api-docs:
 | 
						||
    enabled: true # 1. 是否开启 Swagger 接文档的元数据
 | 
						||
    path: /v3/api-docs
 | 
						||
  swagger-ui:
 | 
						||
    enabled: true # 2.1 是否开启 Swagger 文档的官方 UI 界面
 | 
						||
    path: /swagger-ui.html
 | 
						||
  default-flat-param-object: true # 参见 https://doc.xiaominfo.com/docs/faq/v4/knife4j-parameterobject-flat-param 文档
 | 
						||
 | 
						||
knife4j:
 | 
						||
  enable: true # 2.2 是否开启 Swagger 文档的 Knife4j UI 界面
 | 
						||
  setting:
 | 
						||
    language: zh_cn
 | 
						||
 | 
						||
# MyBatis Plus 的配置项
 | 
						||
mybatis-plus:
 | 
						||
  configuration:
 | 
						||
    map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
 | 
						||
  global-config:
 | 
						||
    db-config:
 | 
						||
      id-type: NONE # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。
 | 
						||
      logic-delete-value: 1 # 逻辑已删除值(默认为 1)
 | 
						||
      logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
 | 
						||
    banner: false # 关闭控制台的 Banner 打印
 | 
						||
  encryptor:
 | 
						||
    password: XDV71a+xqStEA3WH # 加解密的秘钥,可使用 https://www.imaegoo.com/2020/aes-key-generator/ 网站生成
 | 
						||
 | 
						||
mybatis-plus-join:
 | 
						||
  banner: false # 关闭控制台的 Banner 打印
 | 
						||
 | 
						||
# Spring Data Redis 配置
 | 
						||
spring:
 | 
						||
  data:
 | 
						||
    redis:
 | 
						||
      repositories:
 | 
						||
        enabled: false # 项目未使用到 Spring Data Redis 的 Repository,所以直接禁用,保证启动速度
 | 
						||
 | 
						||
--- #################### jysoft相关配置 ####################
 | 
						||
 | 
						||
jysoft:
 | 
						||
  info:
 | 
						||
    version: 1.0.0
 | 
						||
    base-package: com.jysoft.module.log
 | 
						||
  web:
 | 
						||
    admin-ui:
 | 
						||
      url: http://dashboard.jysoft.com # Admin 管理后台 UI 的地址
 | 
						||
  swagger:
 | 
						||
    title: 管理后台
 | 
						||
    description: 提供审计日志管理
 | 
						||
    version: ${jysoft.info.version}
 | 
						||
    base-package: ${jysoft.info.base-package}
 | 
						||
  tenant: # 多租户相关配置项
 | 
						||
    enable: true
 | 
						||
 | 
						||
debug: false
 | 
						||
 | 
						||
 | 
						||
--- #################### 数据库相关配置 ####################
 | 
						||
spring:
 | 
						||
  # 数据源配置项
 | 
						||
  autoconfigure:
 | 
						||
    exclude:
 | 
						||
      - com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
 | 
						||
  datasource:
 | 
						||
    druid: # Druid 【监控】相关的全局配置
 | 
						||
      web-stat-filter:
 | 
						||
        enabled: true
 | 
						||
      stat-view-servlet:
 | 
						||
        enabled: true
 | 
						||
        allow: # 设置白名单,不填则允许所有访问
 | 
						||
        url-pattern: /druid/*
 | 
						||
        login-username: # 控制台管理用户名和密码
 | 
						||
        login-password:
 | 
						||
      filter:
 | 
						||
        stat:
 | 
						||
          enabled: true
 | 
						||
          log-slow-sql: true # 慢 SQL 记录
 | 
						||
          slow-sql-millis: 100
 | 
						||
          merge-sql: true
 | 
						||
        wall:
 | 
						||
          config:
 | 
						||
            multi-statement-allow: true
 | 
						||
    dynamic: # 多数据源配置
 | 
						||
      druid: # Druid 【连接池】相关的全局配置
 | 
						||
        initial-size: 1 # 初始连接数
 | 
						||
        min-idle: 1 # 最小连接池数量
 | 
						||
        max-active: 20 # 最大连接池数量
 | 
						||
        max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒
 | 
						||
        time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒
 | 
						||
        min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒
 | 
						||
        max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒
 | 
						||
        validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效
 | 
						||
        test-while-idle: true
 | 
						||
        test-on-borrow: false
 | 
						||
        test-on-return: false
 | 
						||
      primary: master
 | 
						||
      datasource:
 | 
						||
        master:
 | 
						||
#          url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
 | 
						||
#          url: jdbc:mysql://220.248.250.227:49961/sbd_zhhq?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
 | 
						||
          url: jdbc:mysql://localhost:3306/sbd-zhhq?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
 | 
						||
          #          url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.master.name} # PostgreSQL 连接的示例
 | 
						||
          #          url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
 | 
						||
          #          url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.master.name} # SQLServer 连接的示例
 | 
						||
#          username: jysoft
 | 
						||
          username: root
 | 
						||
          password: root
 | 
						||
#          password: Jysoft@#2023
 | 
						||
#          username: sa
 | 
						||
#          password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
 | 
						||
#        slave: # 模拟从库,可根据自己需要修改
 | 
						||
#          name: roof-vue-pro
 | 
						||
#          url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
 | 
						||
#          url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例
 | 
						||
#          url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
 | 
						||
#          url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
 | 
						||
#          url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.slave.name} # SQLServer 连接的示例
 | 
						||
#          username: root
 | 
						||
#          password: 123456
 | 
						||
#          username: sa
 | 
						||
#          password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
 | 
						||
 | 
						||
--- #################### 监控相关配置 ####################
 | 
						||
 | 
						||
# 日志文件配置
 | 
						||
logging:
 | 
						||
  level:
 | 
						||
    # 配置自己写的 MyBatis Mapper 打印日志
 | 
						||
    com.jysoft.module.log.dal.mapper: debug
 | 
						||
 | 
						||
--- #################### 定时任务配置多租户需求 ####################
 | 
						||
xxl:
 | 
						||
  job:
 | 
						||
    enabled: false # 是否开启调度中心,默认为 true 开启
 | 
						||
    admin:
 | 
						||
      addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址
 | 
						||
 | 
						||
--- #################### jysoft相关配置 ####################
 | 
						||
 | 
						||
# jysoft配置项,设置当前项目所有自定义的配置
 | 
						||
jysoft:
 | 
						||
  env: # 多环境的配置项
 | 
						||
    tag: ${HOSTNAME}
 | 
						||
  security:
 | 
						||
    mock-enable: true
 | 
						||
  access-log: # 访问日志的配置项
 | 
						||
    enable: true
 | 
						||
server:
 | 
						||
  tomcat:
 | 
						||
    initial-memory: 128m
 | 
						||
    max-memory: 256m
 | 
						||
 |