[重磅更新] 升级 dubbo 3.0 使用原生 starter 整合 减少与 feign 的无用兼容配置
parent
16a349708b
commit
c31d52d8b4
|
|
@ -17,6 +17,13 @@ server:
|
||||||
dubbo:
|
dubbo:
|
||||||
application:
|
application:
|
||||||
logger: slf4j
|
logger: slf4j
|
||||||
|
# 可选值 interface、instance、all,默认是 all,即接口级地址、应用级地址都注册
|
||||||
|
register-mode: all
|
||||||
|
service-discovery:
|
||||||
|
# FORCE_INTERFACE,只消费接口级地址,如无地址则报错,单订阅 2.x 地址
|
||||||
|
# APPLICATION_FIRST,智能决策接口级/应用级地址,双订阅
|
||||||
|
# FORCE_APPLICATION,只消费应用级地址,如无地址则报错,单订阅 3.x 地址
|
||||||
|
migration: APPLICATION_FIRST
|
||||||
protocol:
|
protocol:
|
||||||
# 使用dubbo协议通信
|
# 使用dubbo协议通信
|
||||||
name: dubbo
|
name: dubbo
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
<flatten-maven-plugin.version>1.1.0</flatten-maven-plugin.version>
|
<flatten-maven-plugin.version>1.1.0</flatten-maven-plugin.version>
|
||||||
<nacos.client.version>2.0.4</nacos.client.version>
|
<nacos.client.version>2.0.4</nacos.client.version>
|
||||||
<seata.version>1.4.2</seata.version>
|
<seata.version>1.4.2</seata.version>
|
||||||
<dubbo.version>2.7.15</dubbo.version>
|
<dubbo.version>3.0.6</dubbo.version>
|
||||||
<spring.context.support.version>1.0.11</spring.context.support.version>
|
<spring.context.support.version>1.0.11</spring.context.support.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,9 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>org.apache.dubbo</groupId>
|
||||||
<artifactId>spring-cloud-starter-dubbo</artifactId>
|
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>org.apache.dubbo</groupId>
|
||||||
<artifactId>spring-cloud-starter-dubbo</artifactId>
|
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,12 @@ public class SaTokenDubboConsumerFilter implements Filter {
|
||||||
|
|
||||||
// 追加 Id-Token 参数
|
// 追加 Id-Token 参数
|
||||||
if(SaManager.getConfig().getCheckIdToken()) {
|
if(SaManager.getConfig().getCheckIdToken()) {
|
||||||
RpcContext.getContext().setAttachment(SaIdUtil.ID_TOKEN, SaIdUtil.getToken());
|
RpcContext.getServiceContext().setAttachment(SaIdUtil.ID_TOKEN, SaIdUtil.getToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. 调用前,向下传递会话Token
|
// 1. 调用前,向下传递会话Token
|
||||||
if(SaManager.getSaTokenContextOrSecond() != SaTokenContextDefaultImpl.defaultContext) {
|
if(SaManager.getSaTokenContextOrSecond() != SaTokenContextDefaultImpl.defaultContext) {
|
||||||
RpcContext.getContext().setAttachment(SaTokenConsts.JUST_CREATED, StpUtil.getTokenValueNotCut());
|
RpcContext.getServiceContext().setAttachment(SaTokenConsts.JUST_CREATED, StpUtil.getTokenValueNotCut());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 开始调用
|
// 2. 开始调用
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public class DubboRequestFilter implements Filter {
|
||||||
return invoker.invoke(invocation);
|
return invoker.invoke(invocation);
|
||||||
}
|
}
|
||||||
String client = CommonConstants.PROVIDER;
|
String client = CommonConstants.PROVIDER;
|
||||||
if (RpcContext.getContext().isConsumerSide()) {
|
if (RpcContext.getServiceContext().isConsumerSide()) {
|
||||||
client = CommonConstants.CONSUMER;
|
client = CommonConstants.CONSUMER;
|
||||||
}
|
}
|
||||||
String baselog = "Client[" + client + "],InterfaceName=[" + invocation.getInvoker().getInterface().getSimpleName() + "],MethodName=[" + invocation.getMethodName() + "]";
|
String baselog = "Client[" + client + "],InterfaceName=[" + invocation.getInvoker().getInterface().getSimpleName() + "],MethodName=[" + invocation.getMethodName() + "]";
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,9 @@
|
||||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>org.apache.dubbo</groupId>
|
||||||
<artifactId>spring-cloud-starter-dubbo</artifactId>
|
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,9 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>org.apache.dubbo</groupId>
|
||||||
<artifactId>spring-cloud-starter-dubbo</artifactId>
|
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue