検索
ホームページJava&#&チュートリアルSpringbootのyml設定ファイルの使い方

Springbootのyml設定ファイルの使い方

May 11, 2023 pm 12:19 PM
springbootyml

1. サービス構成

server:
  port: 8989
  servlet:
  	# context-path就是端口号与服务之间要加的一段路径,比如localhost:8080/wcm/login/login的/wcm就是
    context-path: /

2. データベース接続

spring:
   datasource:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://127.0.0.1:3306/jxc_manage?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
      username: root
      password: root
      # 数据库连接池
      hikari:
        # 连接池名
        pool-name: DateHikariCP
        # 最小空闲连接数
        minimum-idle: 5
        # 空闲连接存活最大时间,默认600000(10分钟)
        idle-timeout: 180000
        # 最大连接数,默认10
        maximum-pool-size: 10
        # 从连接池返回的连接的自动提交
        auto-commit: true
        # 连接最大存活时间,0表示永久存活,默认1800000(30分钟)
        max-lifetime: 1800000
        # 连接超时时间,默认30000(30秒)
        connection-timeout: 30000
        # 测试连接是否可用的查询语句
        connection-test-query: SELECT 1
        
   ## freemarker
   freemarker:
     suffix: .ftl
     content-type: text/html
     charset: UTF-8
     template-loader-path: classpath:/views/
     request-context-attribute: ctx
     settings:
        number_format: 0.##

3. Mybatis-Plus

# Mybatis-plus配置
mybatis-plus:
  #配置Mapper映射文件
  mapper-locations: classpath*:/mapper/*Mapper.xml
  # 配置MyBatis数据返回类型别名(默认别名是类名)
  type-aliases-package: com.lzj.admin.pojo
  configuration:
    # 自动驼峰命名
    map-underscore-to-camel-case: true

4. ログの印刷

## SQL 打印(方法接口所在的包,不是Mapper.xml所在的包)
logging:
  # 日志级别
  level:
    com.lzj.admin.mapper: debug
    
 ## 控制台日志输出格式
  pattern:
    console: '%d{2100-01-01 13:14:00.666} [%thread] %-5level %logger{50} - %msg%n'

5. Redis

#redis集群
spring:
  redis:
    host: 127.0.0.1
    port: 6379
    timeout: 20000
#    集群环境打开下面注释,单机不需要打开
#    cluster:
#      集群信息
#      nodes: xxx.xxx.xxx.xxx:xxxx,xxx.xxx.xxx.xxx:xxxx,xxx.xxx.xxx.xxx:xxxx
#      #默认值是5 一般当此值设置过大时,容易报:Too many Cluster redirections
#      maxRedirects: 3
    pool:
      max-active: 8
      min-idle: 0
      max-idle: 8
      max-wait: -1
    password:

添付ファイル: yml 基本構文

Springbootのyml設定ファイルの使い方

以上がSpringbootのyml設定ファイルの使い方の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明
この記事は亿速云で複製されています。侵害がある場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

SecLists

SecLists

SecLists は、セキュリティ テスターの究極の相棒です。これは、セキュリティ評価中に頻繁に使用されるさまざまな種類のリストを 1 か所にまとめたものです。 SecLists は、セキュリティ テスターが必要とする可能性のあるすべてのリストを便利に提供することで、セキュリティ テストをより効率的かつ生産的にするのに役立ちます。リストの種類には、ユーザー名、パスワード、URL、ファジング ペイロード、機密データ パターン、Web シェルなどが含まれます。テスターはこのリポジトリを新しいテスト マシンにプルするだけで、必要なあらゆる種類のリストにアクセスできるようになります。

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

AtomエディタMac版ダウンロード

AtomエディタMac版ダウンロード

最も人気のあるオープンソースエディター

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

このプロジェクトは osdn.net/projects/mingw に移行中です。引き続きそこでフォローしていただけます。 MinGW: GNU Compiler Collection (GCC) のネイティブ Windows ポートであり、ネイティブ Windows アプリケーションを構築するための自由に配布可能なインポート ライブラリとヘッダー ファイルであり、C99 機能をサポートする MSVC ランタイムの拡張機能が含まれています。すべての MinGW ソフトウェアは 64 ビット Windows プラットフォームで実行できます。