Commit 8427159d30786f83a37d2cca599e3fd95a290d4f

Authored by YunaiV
1 parent 014f9153

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

src/main/resources/application.yaml
... ... @@ -2,19 +2,6 @@ spring:
2 2 application:
3 3 name: dashboard
4 4  
5   - # 数据源配置项 TODO 多数据源;TODO 监控配置
6   - datasource:
7   - url: jdbc:mysql://127.0.1:33061/ruoyi-vue-pro?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
8   - driver-class-name: com.mysql.jdbc.Driver
9   - username: root
10   - password: 123456
11   -
12   - # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
13   - redis:
14   - host: 127.0.0.1 # 地址
15   - port: 6379 # 端口
16   - database: 0 # 数据库索引
17   -
18 5 # Servlet 配置
19 6 servlet:
20 7 # 文件上传相关配置项
... ... @@ -22,15 +9,6 @@ spring:
22 9 max-file-size: 16MB # 单个文件大小
23 10 max-request-size: 32MB # 设置总上传的文件大小
24 11  
25   - # Spring Boot Admin 配置项
26   - boot:
27   - admin:
28   - # Spring Boot Admin Client 客户端的相关配置
29   - client:
30   - url: http://127.0.0.1:8080/${spring.boot.admin.context-path} # 设置 Spring Boot Admin Server 地址
31   - # Spring Boot Admin Server 服务端的相关配置
32   - context-path: /admin # 配置 Spring
33   -
34 12 # Jackson 配置项
35 13 jackson:
36 14 serialization:
... ... @@ -39,10 +17,40 @@ spring:
39 17 write-durations-as-timestamps: true # 设置 Duration 的格式,使用时间戳
40 18 fail-on-empty-beans: false # 允许序列化无属性的 Bean
41 19  
42   -# main:
43   -# lazy-initialization: true # TODO 芋艿:本地开发环境,可以配置下 lazy 延迟加载
  20 +# MyBatis Plus 的配置项
  21 +mybatis-plus:
  22 + configuration:
  23 + map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
  24 +# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 打印日志
  25 + global-config:
  26 + db-config:
  27 + id-type: AUTO # 自增 ID
  28 + logic-delete-value: 1 # 逻辑已删除值(默认为 1)
  29 + logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
  30 + mapper-locations: classpath*:mapper/*.xml
  31 + type-aliases-package: ${yudao.info.base-package}.modules.*.dal.dataobject
  32 +
  33 +--- #################### 数据库相关配置 ####################
  34 +
  35 +spring:
  36 + # 数据源配置项 TODO 多数据源;TODO 监控配置
  37 + datasource:
  38 + name: ruoyi-vue-pro
  39 + url: jdbc:mysql://127.0.1:33061/${spring.datasource.name}?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
  40 + driver-class-name: com.mysql.jdbc.Driver
  41 + username: root
  42 + password: 123456
44 43  
45   - # Quartz 配置项,对应 QuartzProperties 配置类
  44 + # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
  45 + redis:
  46 + host: 127.0.0.1 # 地址
  47 + port: 6379 # 端口
  48 + database: 0 # 数据库索引
  49 +
  50 +--- #################### 定时任务相关配置 ####################
  51 +
  52 +# Quartz 配置项,对应 QuartzProperties 配置类
  53 +spring:
46 54 quartz:
47 55 scheduler-name: schedulerName # Scheduler 名字。默认为 schedulerName
48 56 job-store-type: jdbc # Job 存储器类型。默认为 memory 表示内存,可选 jdbc 使用数据库。
... ... @@ -66,7 +74,41 @@ spring:
66 74 threadPriority: 5 # 线程优先级
67 75 class: org.quartz.simpl.SimpleThreadPool # 线程池类型
68 76 jdbc: # 使用 JDBC 的 JobStore 的时候,JDBC 的配置
69   - initialize-schema: never # 是否自动使用 SQL 初始化 Quartz 表结构。这里设置成 never ,我们手动创建表结构。
  77 + initialize-schema: NEVER # 是否自动使用 SQL 初始化 Quartz 表结构。这里设置成 never ,我们手动创建表结构。
  78 +
  79 +--- #################### 配置中心相关配置 ####################
  80 +
  81 +# Apollo 配置中心
  82 +apollo:
  83 + bootstrap:
  84 + enabled: true # 设置 Apollo 在启动阶段生效
  85 + eagerLoad:
  86 + enabled: true # 设置 Apollo 在日志初始化前生效,可以实现日志的动态级别配置
  87 + jdbc: # 自定义的 JDBC 配置项,用于数据库的地址
  88 + url: ${spring.datasource.url}
  89 + username: ${spring.datasource.username}
  90 + password: ${spring.datasource.password}
  91 +
  92 +--- #################### 监控相关配置 ####################
  93 +
  94 +# Actuator 监控端点的配置项
  95 +management:
  96 + endpoints:
  97 + web:
  98 + exposure:
  99 + include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
  100 +
  101 +# Spring Boot Admin 配置项
  102 +spring:
  103 + boot:
  104 + admin:
  105 + # Spring Boot Admin Client 客户端的相关配置
  106 + client:
  107 + url: http://127.0.0.1:8080/${spring.boot.admin.context-path} # 设置 Spring Boot Admin Server 地址
  108 + # Spring Boot Admin Server 服务端的相关配置
  109 + context-path: /admin # 配置 Spring
  110 +
  111 +--- #################### 芋道相关配置 ####################
70 112  
71 113 # 芋道配置项,设置当前项目所有自定义的配置
72 114 yudao:
... ... @@ -86,45 +128,14 @@ yudao:
86 128 swagger:
87 129 title: 管理后台
88 130 description: 提供管理员管理的所有功能
89   - version: 1.0.0
90   - base-package: cn.iocoder.dashboard.modules
  131 + version: ${yudao.info.base-package}
  132 + base-package: ${yudao.info.base-package}.modules
91 133 captcha:
92 134 timeout: 5m
93 135 width: 160
94 136 height: 60
95 137 file:
96   - base-path: http://127.0.0.1:1024/api/file/get/
  138 + base-path: http://127.0.0.1:${server.port}/${yudao.web.api-prefix}/file/get/
97 139 codegen:
98 140 base-package: ${yudao.info.base-package}.modules
99   - db-schemas: ruoyi-vue-pro
100   -
101   -# Apollo 配置中心
102   -apollo:
103   - bootstrap:
104   - enabled: true # 设置 Apollo 在启动阶段生效
105   - eagerLoad:
106   - enabled: true # 设置 Apollo 在日志初始化前生效,可以实现日志的动态级别配置
107   - jdbc: # 自定义的 JDBC 配置项,用于数据库的地址
108   - url: ${spring.datasource.url}
109   - username: ${spring.datasource.username}
110   - password: ${spring.datasource.password}
111   -
112   -# MyBatis Plus 的配置项
113   -mybatis-plus:
114   - configuration:
115   - map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
116   -# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 打印日志
117   - global-config:
118   - db-config:
119   - id-type: auto # 自增 ID
120   - logic-delete-value: 1 # 逻辑已删除值(默认为 1)
121   - logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
122   - mapper-locations: classpath*:mapper/*.xml
123   - type-aliases-package: ${yudao.info.base-package}.modules.*.dal.dataobject
124   -
125   -# Actuator 监控端点的配置项
126   -management:
127   - endpoints:
128   - web:
129   - exposure:
130   - include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
  141 + db-schemas: ${spring.datasource.name}
... ...