refactor(config): 将配置文件迁移至 Nacos 并优化通知事件
- 移除 application-dev.yaml 和 application-local.yaml 配置文件 - 将 Nacos 配置外置到根 pom 的 nacos.* 属性中 - 添加配置中心文件加载配置(rdms-common.yaml、rdms-common-secret.yaml) - 网关服务仅用 Nacos 做服务发现,不加载配置中心文件 - 为系统服务添加独有敏感配置(rdms-system-server-secret.yaml) - 为 mapper 添加 SQL 日志打印配置 - 为 NotifySendEvent 添加操作人用户编号字段用于排除通知 - 修改 NotifySendEvent 构造函数支持操作人排除参数 - 在通知监听器中实现操作人排除逻辑 - 添加操作人排除功能的单元测试
This commit is contained in:
@@ -54,12 +54,6 @@
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Config 配置中心相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#################### 注册中心 + 配置中心相关配置 ####################
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 192.168.1.103:18848 # Nacos 服务器地址
|
||||
username: # Nacos 账号
|
||||
password: # Nacos 密码
|
||||
discovery: # 【配置中心】配置项
|
||||
namespace: 1924bcfb-4eab-4c58-9003-4a37d5fc2949 # 命名空间。这里使用 dev 开发环境
|
||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||
config: # 【注册中心】配置项
|
||||
namespace: 1924bcfb-4eab-4c58-9003-4a37d5fc2949 # 命名空间。这里使用 dev 开发环境
|
||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||
|
||||
#################### 监控相关配置 ####################
|
||||
# Actuator 监控端点的配置项
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
|
||||
exposure:
|
||||
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#################### 注册中心 + 配置中心相关配置 ####################
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 192.168.1.103:18848 # Nacos 服务器地址
|
||||
username: # Nacos 账号
|
||||
password: # Nacos 密码
|
||||
discovery: # 【配置中心】配置项
|
||||
namespace: 0cd9c1b2-56ba-4e1d-a23b-f951392c46bf # 命名空间。这里使用 dev 开发环境
|
||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||
config: # 【注册中心】配置项
|
||||
namespace: 0cd9c1b2-56ba-4e1d-a23b-f951392c46bf # 命名空间。这里使用 dev 开发环境
|
||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||
|
||||
#################### 监控相关配置 ####################
|
||||
# Actuator 监控端点的配置项
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
|
||||
exposure:
|
||||
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
|
||||
|
||||
|
||||
# 日志文件配置
|
||||
logging:
|
||||
level:
|
||||
org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR
|
||||
|
||||
@@ -2,9 +2,6 @@ spring:
|
||||
application:
|
||||
name: gateway-server
|
||||
|
||||
profiles:
|
||||
active: local
|
||||
|
||||
http:
|
||||
codecs:
|
||||
max-in-memory-size: 10MB # 调整缓冲区大小https://gitee.com/zhijiantianya/rdms-cloud/pulls/176
|
||||
@@ -20,12 +17,15 @@ spring:
|
||||
main:
|
||||
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
|
||||
|
||||
config:
|
||||
import:
|
||||
- optional:classpath:application-${spring.profiles.active}.yaml # 加载【本地】配置
|
||||
- optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml # 加载【Nacos】的配置
|
||||
|
||||
cloud:
|
||||
# 注册中心连接(值由根 pom 的 nacos.* 属性在打包时注入)。网关仅用 Nacos 做服务发现,不加载配置中心文件。
|
||||
nacos:
|
||||
server-addr: @nacos.server-addr@
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
namespace: @nacos.namespace@
|
||||
group: @nacos.group@
|
||||
# Spring Cloud Gateway 配置项,对应 GatewayProperties 类
|
||||
gateway:
|
||||
server:
|
||||
@@ -89,6 +89,16 @@ server:
|
||||
logging:
|
||||
file:
|
||||
name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
|
||||
level:
|
||||
org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR
|
||||
|
||||
# Actuator 监控端点的配置项
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
base-path: /actuator # Actuator 提供的 API 接口的根目录
|
||||
exposure:
|
||||
include: '*' # 开放所有端点
|
||||
|
||||
knife4j:
|
||||
# 聚合 Swagger 文档,参考 https://doc.xiaominfo.com/docs/action/springcloud-gateway 文档
|
||||
|
||||
Reference in New Issue
Block a user