update 重构 将系统内置配置放置到common包内独立加载 不允许用户随意修改

This commit is contained in:
疯狂的狮子Li
2023-06-15 13:26:54 +08:00
parent 3284b8707a
commit 8d675b0c21
17 changed files with 191 additions and 97 deletions

View File

@@ -0,0 +1,17 @@
package org.dromara.common.dubbo.config;
import org.dromara.common.core.factory.YmlPropertySourceFactory;
import org.dromara.common.dubbo.properties.DubboCustomProperties;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
/**
* dubbo 配置类
*/
@AutoConfiguration
@EnableConfigurationProperties(DubboCustomProperties.class)
@PropertySource(value = "classpath:common-dubbo.yml", factory = YmlPropertySourceFactory.class)
public class DubboConfiguration {
}

View File

@@ -1,7 +1,7 @@
package org.dromara.common.dubbo.properties;
import org.dromara.common.dubbo.enumd.RequestLogEnum;
import lombok.Data;
import org.dromara.common.dubbo.enumd.RequestLogEnum;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;

View File

@@ -1 +1 @@
org.dromara.common.dubbo.properties.DubboCustomProperties
org.dromara.common.dubbo.config.DubboConfiguration

View File

@@ -0,0 +1,30 @@
# 内置配置 不允许修改 如需修改请在 nacos 上写相同配置覆盖
dubbo:
application:
logger: slf4j
# 元数据中心 local 本地 remote 远程 这里使用远程便于其他服务获取
metadataType: remote
# 可选值 interface、instance、all默认是 all即接口级地址、应用级地址都注册
register-mode: instance
service-discovery:
# FORCE_INTERFACE只消费接口级地址如无地址则报错单订阅 2.x 地址
# APPLICATION_FIRST智能决策接口级/应用级地址,双订阅
# FORCE_APPLICATION只消费应用级地址如无地址则报错单订阅 3.x 地址
migration: FORCE_APPLICATION
# 注册中心配置
registry:
address: nacos://${spring.cloud.nacos.server-addr}
group: DUBBO_GROUP
parameters:
namespace: ${spring.profiles.active}
# 消费者相关配置
consumer:
# 结果缓存(LRU算法)
# 会有数据不一致问题 建议在注解局部开启
cache: false
# 支持校验注解
validation: jvalidationNew
# 调用重试 不包括第一次 0为不需要重试
retries: 0
# 初始化检查
check: false