Spring Profiles

Server

server:
  port: 443
  servlet.context-path: /
  max-http-header-size: 8KB
  connection-timeout: 5s
  error:
    include-stacktrace: never
    include-binding-errors: never
    include-message: never
  tomcat:
	threads.max: 200
	# リクエストボディの最大サイズ制限
	max-swallow-size: 2MB
	# POST リクエスト全体の最大サイズ制限
	max-http-post-size: 2MB
	# アクセスログはページヒット数やユーザーセッション活動の監視に役立ちます
	accesslog:
	  enabled: true
	  directory: logs
	  file-date-format: yyyy-MM-dd
	  prefix: access_log
	  suffix: .log

SSL

server:
  port: 443
  ssl:
    enabled: true
    key-alias: <your_alias>
    key-password: <keystore_password>
    key-store: classpath:local-ssl.p12
    key-store-password: <keystore_password>
    key-store-type: PKCS12

Tomcat

server:
  tomcat:
    accesslog:
      enabled: true
      file-date-format: .yyyy-MM-dd
      directory: ${dev.tomcat-accesslog-dir}
    # 文字(もじ)
エンコーディング設定(せってい)

    uri-encoding: UTF-8
    # 接続(せつぞく)
タイムアウト (ミリ(びょう)
)
    connection-timeout: 30000
    threads:
      # 最小(さいしょう)
スレッド(すう)

      min-spare: 500
      # 最大(さいだい)
スレッド(すう)

      max: 2500
    # 最大(さいだい)
接続(せつぞく)
(すう)

    max-connections: 5000
    # キューが満杯(まんぱい)場合(ばあい)待機(たいき)
する接続(せつぞく)
(すう)

    accept-count: 1000

Banner

spring:
  # 外部(がいぶ)
設定(せってい)
ファイルのインポート
  config:
    import: optional:sit.yml
  # コンソール ANSI カラー出力(しゅつりょく)

  output:
    ansi:
      enabled: always
  # 起動(きどう)
バナーの場所(ばしょ)

  banner:
    location: banner.txt

Logging

# ログ設定の例
logging:
  config: classpath:logback-spring.xml
  exception-conversion-word: "Logging Occur Error"
  file:
    path: ${dev.logging-file-path}
  charset:
    file: UTF-8
  level:
    root: info
  logback:
    rollingpolicy:
      max-file-size: 10MB
      max-history: 7

Datasource

H2

spring:
  h2:
    console:
      path: '/h2'
      enabled: true
  datasource:
    driver-class-name: org.h2.Driver
    url: jdbc:h2:mem:testdb
    username: 'sa'
    password:

  jpa:
    show-sql: true
    hibernate:
      ddl-auto: update
    database-platform: org.hibernate.dialect.H2Dialect

MySQL

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/DB_NAME?useSSL=false&serverTimezone=Asia/Taipei
    username:
    password:

Postgres

spring:
  datasource:
    url: jdbc:postgresql://localhost:5432/postgres
    username: postgres
    password: postgres

JPA

spring:
  jpa:
    database: mysql
    database-platform: org.hibernate.dialect.MySQL8Dialect
    generate-ddl: true
    hibernate:
      ddl-auto: update
    show-sql: true

Multiple DataSource

spring:
  # 複数(ふくすう)
のデータソース(めい)設定(せってい)

  datasource:
    # (だい)
1データソース
    organization:
      url: ${sit.org-db-url}
      username: ${sit.org-db-name}
      password: ${sit.org-db-pass}
      driver-class-name: com.mysql.cj.jdbc.Driver
    # (だい)
2データソース
    coturn:
      url: ${sit.coturn-db-url}
      username: ${sit.coturn-db-name}
      password: ${sit.coturn-db-pass}
      driver-class-name: com.mysql.cj.jdbc.Driver

Redis

spring:
  redis:
    database: 0
    password:
    lettuce:
      pool:
        max-active: 8
        max-wait: -1
        max-idle: 8
        min-idle: 0

Security

spring:
  security:
    oauth2:
      resourceserver:
        jwt:
          issuer-uri: https://cognito-idp.${sit.aws-region}.amazonaws.com/${sit.aws-user-pool-id}
          jwk-set-uri: https://cognito-idp.${sit.aws-region}.amazonaws.com/${sit.aws-user-pool-id}/.well-known/jwks.json

Spring Doc OpenAPI

# Swagger UI と OpenAPI ドキュメントのアクセスパス
springdoc:
  api-docs:
    path: /api-docs
    enabled: true
  swagger-ui:
    path: /swagger-ui.html
    enabled: true
  cache:
    disabled: false
  writer-with-default-pretty-printer: true