bootstrap config

bootstrap.yaml

server:
  port: 10888
  tomcat:
    uri-encoding: UTF-8
spring:
  profiles:
    active: dev
  application:
    name: archive-service
  cloud:
    nacos:
      config:
        file-extension: yaml
        shared-configs:
          - data-id: shared-spring.yaml
            refresh: false
          - data-id: shared-redis.yaml
            refresh: false
          - data-id: shared-mybatis.yaml
            refresh: false
          - data-id: shared-logs.yaml
            refresh: false
          - data-id: shared-feign.yaml
            refresh: false
          - data-id: shared-logs.yaml # shared logging config
            refresh: false
#          - data-id: shared-feign.yaml # shared feign config
#            refresh: false

lia:
  jdbc:
    database: tb_archive

bootstrap-dev.yaml

spring:
  cloud:
    nacos:
      server-addr: 192.168.2.115:8848 # nacos registry
      discovery:
        namespace: f923fb34-cb0a-4c06-8fca-ad61ea61a3f0
        group: DEFAULT_GROUP
        ip: 192.168.2.115
logging:
  level:
    asia.liminality: debug

nacos config

shared-spring.yaml

spring:
  jackson:
    default-property-inclusion: non_null
  main:
    allow-bean-definition-overriding: true
  mvc:
    pathmatch:
      # Fixes the exception: swagger Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
      # Because Springfox's path matching is based on AntPathMatcher, while Spring Boot 2.6.X uses PathPatternMatcher
      matching-strategy: ant_path_matcher

shared-redis.yaml

spring:
  redis:
    host: ${lia.redis.host:192.168.2.115}
    password: ${lia.redis.password:github}
    lettuce:
      pool:
        max-active: ${lia.redis.pool.max-active:8}
        max-idle: ${lia.redis.pool.max-idle:8}
        min-idle: ${lia.redis.pool.min-idle:1}
        max-wait: ${lia.redis.pool.max-wait:300}

shared-mybatis.yaml

MySQL

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://${sh.jdbc.host:127.0.0.1}/${sh.jdbc.database}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false
    username: ${lia.jdbc.username:root}
    password: ${lia.jdbc.password:794211}
    
mybatis-plus:
  configuration:
    default-enum-type-handler: com.baomidou.mybatisplus.core.handlers.MybatisEnumTypeHandler
  global-config:
    db-config:
      logic-delete-field: deletedAt
      logic-not-delete-value: "null"
      logic-delete-value: "now()"
      id-type: assign_id
      insert-strategy: not_null
      update-strategy: not_null

PostgreSQL

spring:
  datasource:
    driver-class-name: org.postgresql.Driver
    url: jdbc:postgresql://${lia.jdbc.host:192.168.2.115}:${lia.jdbc.port:5432}/${lia.jdbc.database}?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
    username: ${lia.jdbc.username:postgres}
    password: ${lia.jdbc.password:github}
mybatis-plus:
  configuration:
    default-enum-type-handler: com.baomidou.mybatisplus.core.handlers.MybatisEnumTypeHandler
  global-config:
    db-config:
      logic-delete-field: deletedAt
      logic-not-delete-value: "null"
      logic-delete-value: "now()"
      id-type: assign_id
      insert-strategy: ignored
      update-strategy: ignored
      select-strategy: not_null

shared-logs.yaml

logging:
  pattern:
    dateformat: HH:mm:ss.SSS
    console: "%clr(%d{${LOG_DATEFORMAT_PATTERN}}){faint}-[${hostname}][%X{requestId:-sys}] %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n"
    file: "%d{${LOG_DATEFORMAT_PATTERN}}-[${hostname}][%X{requestId:-sys}]-${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%15.15t] %-40.40logger{39} : %m%n"
  file:
    path: "logs/${spring.application.name}"

shared-feign.yaml

feign:
  client:
    config:
      default: # the default global config
        loggerLevel: BASIC # log level; BASIC is the basic request and response info
  httpclient:
    enabled: true # enable Feign's HttpClient support
    max-connections: 200 # max connections
    max-connections-per-route: 50 # max connections per route
  sentinel:
    enabled: true