Jelajahi Sumber

梳理配置文件,进行分类,更容易理解

YunaiV 4 tahun lalu
induk
melakukan
8427159d30
1 mengubah file dengan 72 tambahan dan 61 penghapusan
  1. 72 61
      src/main/resources/application.yaml

+ 72 - 61
src/main/resources/application.yaml

@@ -2,19 +2,6 @@ spring:
   application:
     name: dashboard
 
-  # 数据源配置项 TODO 多数据源;TODO 监控配置
-  datasource:
-    url: jdbc:mysql://127.0.1:33061/ruoyi-vue-pro?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
-    driver-class-name: com.mysql.jdbc.Driver
-    username: root
-    password: 123456
-
-  # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
-  redis:
-    host: 127.0.0.1 # 地址
-    port: 6379 # 端口
-    database: 0 # 数据库索引
-
   # Servlet 配置
   servlet:
     # 文件上传相关配置项
@@ -22,15 +9,6 @@ spring:
       max-file-size: 16MB # 单个文件大小
       max-request-size: 32MB # 设置总上传的文件大小
 
-  # Spring Boot Admin 配置项
-  boot:
-    admin:
-      # Spring Boot Admin Client 客户端的相关配置
-      client:
-        url: http://127.0.0.1:8080/${spring.boot.admin.context-path} # 设置 Spring Boot Admin Server 地址
-      # Spring Boot Admin Server 服务端的相关配置
-      context-path: /admin # 配置 Spring
-
   # Jackson 配置项
   jackson:
     serialization:
@@ -39,10 +17,40 @@ spring:
       write-durations-as-timestamps: true # 设置 Duration 的格式,使用时间戳
       fail-on-empty-beans: false # 允许序列化无属性的 Bean
 
-#  main:
-#    lazy-initialization: true # TODO 芋艿:本地开发环境,可以配置下 lazy 延迟加载
+# MyBatis Plus 的配置项
+mybatis-plus:
+  configuration:
+    map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
+#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 打印日志
+  global-config:
+    db-config:
+      id-type: AUTO # 自增 ID
+      logic-delete-value: 1 # 逻辑已删除值(默认为 1)
+      logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
+  mapper-locations: classpath*:mapper/*.xml
+  type-aliases-package: ${yudao.info.base-package}.modules.*.dal.dataobject
+
+--- #################### 数据库相关配置 ####################
+
+spring:
+  # 数据源配置项 TODO 多数据源;TODO 监控配置
+  datasource:
+    name: ruoyi-vue-pro
+    url: jdbc:mysql://127.0.1:33061/${spring.datasource.name}?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
+    driver-class-name: com.mysql.jdbc.Driver
+    username: root
+    password: 123456
 
-  # Quartz 配置项,对应 QuartzProperties 配置类
+  # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
+  redis:
+    host: 127.0.0.1 # 地址
+    port: 6379 # 端口
+    database: 0 # 数据库索引
+
+--- #################### 定时任务相关配置 ####################
+
+# Quartz 配置项,对应 QuartzProperties 配置类
+spring:
   quartz:
     scheduler-name: schedulerName # Scheduler 名字。默认为 schedulerName
     job-store-type: jdbc # Job 存储器类型。默认为 memory 表示内存,可选 jdbc 使用数据库。
@@ -66,7 +74,41 @@ spring:
             threadPriority: 5 # 线程优先级
             class: org.quartz.simpl.SimpleThreadPool # 线程池类型
     jdbc: # 使用 JDBC 的 JobStore 的时候,JDBC 的配置
-      initialize-schema: never # 是否自动使用 SQL 初始化 Quartz 表结构。这里设置成 never ,我们手动创建表结构。
+      initialize-schema: NEVER # 是否自动使用 SQL 初始化 Quartz 表结构。这里设置成 never ,我们手动创建表结构。
+
+--- #################### 配置中心相关配置 ####################
+
+# Apollo 配置中心
+apollo:
+  bootstrap:
+    enabled: true # 设置 Apollo 在启动阶段生效
+    eagerLoad:
+      enabled: true # 设置 Apollo 在日志初始化前生效,可以实现日志的动态级别配置
+  jdbc: # 自定义的 JDBC 配置项,用于数据库的地址
+    url: ${spring.datasource.url}
+    username: ${spring.datasource.username}
+    password: ${spring.datasource.password}
+
+--- #################### 监控相关配置 ####################
+
+# Actuator 监控端点的配置项
+management:
+  endpoints:
+    web:
+      exposure:
+        include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
+
+# Spring Boot Admin 配置项
+spring:
+  boot:
+    admin:
+      # Spring Boot Admin Client 客户端的相关配置
+      client:
+        url: http://127.0.0.1:8080/${spring.boot.admin.context-path} # 设置 Spring Boot Admin Server 地址
+      # Spring Boot Admin Server 服务端的相关配置
+      context-path: /admin # 配置 Spring
+
+--- #################### 芋道相关配置 ####################
 
 # 芋道配置项,设置当前项目所有自定义的配置
 yudao:
@@ -86,45 +128,14 @@ yudao:
   swagger:
     title: 管理后台
     description: 提供管理员管理的所有功能
-    version: 1.0.0
-    base-package: cn.iocoder.dashboard.modules
+    version: ${yudao.info.base-package}
+    base-package: ${yudao.info.base-package}.modules
   captcha:
     timeout: 5m
     width: 160
     height: 60
   file:
-    base-path: http://127.0.0.1:1024/api/file/get/
+    base-path: http://127.0.0.1:${server.port}/${yudao.web.api-prefix}/file/get/
   codegen:
     base-package: ${yudao.info.base-package}.modules
-    db-schemas: ruoyi-vue-pro
-
-# Apollo 配置中心
-apollo:
-  bootstrap:
-    enabled: true # 设置 Apollo 在启动阶段生效
-    eagerLoad:
-      enabled: true # 设置 Apollo 在日志初始化前生效,可以实现日志的动态级别配置
-  jdbc: # 自定义的 JDBC 配置项,用于数据库的地址
-    url: ${spring.datasource.url}
-    username: ${spring.datasource.username}
-    password: ${spring.datasource.password}
-
-# MyBatis Plus 的配置项
-mybatis-plus:
-  configuration:
-    map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
-#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 打印日志
-  global-config:
-    db-config:
-      id-type: auto # 自增 ID
-      logic-delete-value: 1 # 逻辑已删除值(默认为 1)
-      logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
-  mapper-locations: classpath*:mapper/*.xml
-  type-aliases-package: ${yudao.info.base-package}.modules.*.dal.dataobject
-
-# Actuator 监控端点的配置项
-management:
-  endpoints:
-    web:
-      exposure:
-        include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
+    db-schemas: ${spring.datasource.name}