Merge remote-tracking branch 'upstream/master'

pull/562/head
mercyblitz 6 years ago
commit 7af5e12003

@ -62,7 +62,7 @@
<organization>Alibaba</organization> <organization>Alibaba</organization>
<url>https://github.com/mercyblitz</url> <url>https://github.com/mercyblitz</url>
</developer> </developer>
<developer> <developer>
<name>yunzheng</name> <name>yunzheng</name>
<email>yunzheng1228@gmail.com</email> <email>yunzheng1228@gmail.com</email>
</developer> </developer>
@ -96,7 +96,7 @@
<module>spring-cloud-alibaba-sentinel-zuul</module> <module>spring-cloud-alibaba-sentinel-zuul</module>
<module>spring-cloud-alibaba-nacos-config</module> <module>spring-cloud-alibaba-nacos-config</module>
<module>spring-cloud-alibaba-nacos-discovery</module> <module>spring-cloud-alibaba-nacos-discovery</module>
<module>spring-cloud-alibaba-fescar</module> <module>spring-cloud-alibaba-seata</module>
<module>spring-cloud-stream-binder-rocketmq</module> <module>spring-cloud-stream-binder-rocketmq</module>
<module>spring-cloud-alibaba-nacos-config-server</module> <module>spring-cloud-alibaba-nacos-config-server</module>
<module>spring-cloud-alibaba-dubbo</module> <module>spring-cloud-alibaba-dubbo</module>

@ -63,7 +63,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-fescar</artifactId> <artifactId>spring-cloud-alibaba-seata</artifactId>
<version>${spring.cloud.alibaba.version}</version> <version>${spring.cloud.alibaba.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>

@ -17,10 +17,10 @@
<description>Spring Cloud Alibaba Dependencies</description> <description>Spring Cloud Alibaba Dependencies</description>
<properties> <properties>
<sentinel.version>1.4.2</sentinel.version> <sentinel.version>1.5.1</sentinel.version>
<oss.version>3.1.0</oss.version> <oss.version>3.1.0</oss.version>
<fescar.version>0.4.0</fescar.version> <fescar.version>0.4.2</fescar.version>
<nacos.client.version>1.0.0-RC3</nacos.client.version> <nacos.client.version>1.0.0</nacos.client.version>
<nacos.config.version>0.8.0</nacos.config.version> <nacos.config.version>0.8.0</nacos.config.version>
<acm.version>1.0.8</acm.version> <acm.version>1.0.8</acm.version>
<ans.version>1.0.1</ans.version> <ans.version>1.0.1</ans.version>
@ -272,7 +272,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-fescar</artifactId> <artifactId>spring-cloud-alibaba-seata</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
@ -325,7 +325,7 @@
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-fescar</artifactId> <artifactId>spring-cloud-starter-alibaba-seata</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>

@ -1,35 +0,0 @@
registry {
# file 、nacos 、redis
type = "file"
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
}
redis {
serverAddr = "localhost:6379"
db = "0"
}
file {
name = "file.conf"
}
}
config {
# file nacos apollo
type = "file"
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
}
apollo {
app.id = "fescar-server"
apollo.meta = "http://192.168.1.204:8801"
}
file {
name = "file.conf"
}
}

@ -1,35 +0,0 @@
registry {
# file 、nacos 、redis
type = "file"
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
}
redis {
serverAddr = "localhost:6379"
db = "0"
}
file {
name = "file.conf"
}
}
config {
# file nacos apollo
type = "file"
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
}
apollo {
app.id = "fescar-server"
apollo.meta = "http://192.168.1.204:8801"
}
file {
name = "file.conf"
}
}

@ -1,35 +0,0 @@
registry {
# file 、nacos 、redis
type = "file"
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
}
redis {
serverAddr = "localhost:6379"
db = "0"
}
file {
name = "file.conf"
}
}
config {
# file nacos apollo
type = "file"
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
}
apollo {
app.id = "fescar-server"
apollo.meta = "http://192.168.1.204:8801"
}
file {
name = "file.conf"
}
}

@ -1,35 +0,0 @@
registry {
# file 、nacos 、redis
type = "file"
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
}
redis {
serverAddr = "localhost:6379"
db = "0"
}
file {
name = "file.conf"
}
}
config {
# file nacos apollo
type = "file"
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
}
apollo {
app.id = "fescar-server"
apollo.meta = "http://192.168.1.204:8801"
}
file {
name = "file.conf"
}
}

@ -28,10 +28,10 @@
<module>ans-example/ans-consumer-feign-example</module> <module>ans-example/ans-consumer-feign-example</module>
<module>ans-example/ans-consumer-ribbon-example</module> <module>ans-example/ans-consumer-ribbon-example</module>
<module>ans-example/ans-provider-example</module> <module>ans-example/ans-provider-example</module>
<module>fescar-example/business-service</module> <module>seata-example/business-service</module>
<module>fescar-example/order-service</module> <module>seata-example/order-service</module>
<module>fescar-example/storage-service</module> <module>seata-example/storage-service</module>
<module>fescar-example/account-service</module> <module>seata-example/account-service</module>
<module>acm-example/acm-local-example</module> <module>acm-example/acm-local-example</module>
<module>rocketmq-example/rocketmq-consume-example</module> <module>rocketmq-example/rocketmq-consume-example</module>
<module>rocketmq-example/rocketmq-produce-example</module> <module>rocketmq-example/rocketmq-produce-example</module>

@ -14,7 +14,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-fescar</artifactId> <artifactId>spring-cloud-starter-alibaba-seata</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

@ -20,17 +20,26 @@ transport {
worker-thread-size = 8 worker-thread-size = 8
} }
} }
store {
# branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
max-branch-session-size = 16384
# globe session size , if exceeded throws exceptions
max-global-session-size = 512
# file buffer size , if exceeded allocate new buffer
file-write-buffer-cache-size = 16384
# when recover batch read size
session.reload.read_size = 100
}
service { service {
#vgroup->rgroup #vgroup->rgroup
vgroup_mapping.account-service-fescar-service-group = "localRgroup" vgroup_mapping.account-service-fescar-service-group = "default"
#only support single node #only support single node
localRgroup.grouplist = "127.0.0.1:8091" default.grouplist = "127.0.0.1:8091"
#degrade current not support #degrade current not support
enableDegrade = false enableDegrade = false
#disable #disable
disable = false disable = false
} }
client { client {
async.commit.buffer.limit = 10000 async.commit.buffer.limit = 10000
lock { lock {

@ -0,0 +1,55 @@
registry {
# file 、nacos 、eureka、redis、zk、consul
type = "file"
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
}
eureka {
serviceUrl = "http://localhost:1001/eureka"
application = "default"
weight = "1"
}
redis {
serverAddr = "localhost:6379"
db = "0"
}
zk {
cluster = "default"
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
consul {
cluster = "default"
serverAddr = "127.0.0.1:8500"
}
file {
name = "file.conf"
}
}
config {
# file、nacos 、apollo、zk
type = "file"
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
}
apollo {
app.id = "fescar-server"
apollo.meta = "http://192.168.1.204:8801"
}
zk {
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
file {
name = "file.conf"
}
}

@ -14,7 +14,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-fescar</artifactId> <artifactId>spring-cloud-starter-alibaba-seata</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>

@ -20,17 +20,26 @@ transport {
worker-thread-size = 8 worker-thread-size = 8
} }
} }
store {
# branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
max-branch-session-size = 16384
# globe session size , if exceeded throws exceptions
max-global-session-size = 512
# file buffer size , if exceeded allocate new buffer
file-write-buffer-cache-size = 16384
# when recover batch read size
session.reload.read_size = 100
}
service { service {
#vgroup->rgroup #vgroup->rgroup
vgroup_mapping.storage-service-fescar-service-group = "localRgroup" vgroup_mapping.business-service-fescar-service-group = "default"
#only support single node #only support single node
localRgroup.grouplist = "127.0.0.1:8091" default.grouplist = "127.0.0.1:8091"
#degrade current not support #degrade current not support
enableDegrade = false enableDegrade = false
#disable #disable
disable = false disable = false
} }
client { client {
async.commit.buffer.limit = 10000 async.commit.buffer.limit = 10000
lock { lock {

@ -0,0 +1,55 @@
registry {
# file 、nacos 、eureka、redis、zk、consul
type = "file"
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
}
eureka {
serviceUrl = "http://localhost:1001/eureka"
application = "default"
weight = "1"
}
redis {
serverAddr = "localhost:6379"
db = "0"
}
zk {
cluster = "default"
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
consul {
cluster = "default"
serverAddr = "127.0.0.1:8500"
}
file {
name = "file.conf"
}
}
config {
# file、nacos 、apollo、zk
type = "file"
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
}
apollo {
app.id = "fescar-server"
apollo.meta = "http://192.168.1.204:8801"
}
zk {
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
file {
name = "file.conf"
}
}

@ -14,7 +14,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-fescar</artifactId> <artifactId>spring-cloud-starter-alibaba-seata</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

@ -20,17 +20,26 @@ transport {
worker-thread-size = 8 worker-thread-size = 8
} }
} }
store {
# branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
max-branch-session-size = 16384
# globe session size , if exceeded throws exceptions
max-global-session-size = 512
# file buffer size , if exceeded allocate new buffer
file-write-buffer-cache-size = 16384
# when recover batch read size
session.reload.read_size = 100
}
service { service {
#vgroup->rgroup #vgroup->rgroup
vgroup_mapping.business-service-fescar-service-group = "localRgroup" vgroup_mapping.order-service-fescar-service-group = "default"
#only support single node #only support single node
localRgroup.grouplist = "127.0.0.1:8091" default.grouplist = "127.0.0.1:8091"
#degrade current not support #degrade current not support
enableDegrade = false enableDegrade = false
#disable #disable
disable = false disable = false
} }
client { client {
async.commit.buffer.limit = 10000 async.commit.buffer.limit = 10000
lock { lock {

@ -0,0 +1,55 @@
registry {
# file 、nacos 、eureka、redis、zk、consul
type = "file"
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
}
eureka {
serviceUrl = "http://localhost:1001/eureka"
application = "default"
weight = "1"
}
redis {
serverAddr = "localhost:6379"
db = "0"
}
zk {
cluster = "default"
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
consul {
cluster = "default"
serverAddr = "127.0.0.1:8500"
}
file {
name = "file.conf"
}
}
config {
# file、nacos 、apollo、zk
type = "file"
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
}
apollo {
app.id = "fescar-server"
apollo.meta = "http://192.168.1.204:8801"
}
zk {
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
file {
name = "file.conf"
}
}

@ -1,11 +1,11 @@
# Fescar Example # Seata Example
## 项目说明 ## 项目说明
本项目演示如何使用 Fescar Starter 完成 Spring Cloud 应用的分布式事务接入。 本项目演示如何使用 Seata Starter 完成 Spring Cloud 应用的分布式事务接入。
[Fescar](https://github.com/alibaba/fescar) 是 阿里巴巴 开源的 分布式事务中间件,以 高效 并且对业务 0 侵入 的方式,解决 微服务 场景下面临的分布式事务问题。 [Seata](https://github.com/seata/seata) 是 阿里巴巴 开源的 分布式事务中间件,以 高效 并且对业务 0 侵入 的方式,解决 微服务 场景下面临的分布式事务问题。

@ -14,7 +14,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-fescar</artifactId> <artifactId>spring-cloud-starter-alibaba-seata</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

@ -20,17 +20,26 @@ transport {
worker-thread-size = 8 worker-thread-size = 8
} }
} }
store {
# branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
max-branch-session-size = 16384
# globe session size , if exceeded throws exceptions
max-global-session-size = 512
# file buffer size , if exceeded allocate new buffer
file-write-buffer-cache-size = 16384
# when recover batch read size
session.reload.read_size = 100
}
service { service {
#vgroup->rgroup #vgroup->rgroup
vgroup_mapping.order-service-fescar-service-group = "localRgroup" vgroup_mapping.storage-service-fescar-service-group = "default"
#only support single node #only support single node
localRgroup.grouplist = "127.0.0.1:8091" default.grouplist = "127.0.0.1:8091"
#degrade current not support #degrade current not support
enableDegrade = false enableDegrade = false
#disable #disable
disable = false disable = false
} }
client { client {
async.commit.buffer.limit = 10000 async.commit.buffer.limit = 10000
lock { lock {

@ -0,0 +1,55 @@
registry {
# file 、nacos 、eureka、redis、zk、consul
type = "file"
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
}
eureka {
serviceUrl = "http://localhost:1001/eureka"
application = "default"
weight = "1"
}
redis {
serverAddr = "localhost:6379"
db = "0"
}
zk {
cluster = "default"
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
consul {
cluster = "default"
serverAddr = "127.0.0.1:8500"
}
file {
name = "file.conf"
}
}
config {
# file、nacos 、apollo、zk
type = "file"
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
}
apollo {
app.id = "fescar-server"
apollo.meta = "http://192.168.1.204:8801"
}
zk {
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
file {
name = "file.conf"
}
}

@ -1,7 +0,0 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.springframework.cloud.alibaba.fescar.rest.FescarRestTemplateAutoConfiguration,\
org.springframework.cloud.alibaba.fescar.web.FescarHandlerInterceptorConfiguration,\
org.springframework.cloud.alibaba.fescar.GlobalTransactionAutoConfiguration,\
org.springframework.cloud.alibaba.fescar.feign.FescarFeignClientAutoConfiguration,\
org.springframework.cloud.alibaba.fescar.feign.hystrix.FescarHystrixAutoConfiguration

@ -57,14 +57,10 @@ import org.springframework.test.context.junit4.SpringRunner;
"spring.cloud.nacos.config.encode=utf-8", "spring.cloud.nacos.config.encode=utf-8",
"spring.cloud.nacos.config.timeout=1000", "spring.cloud.nacos.config.timeout=1000",
"spring.cloud.nacos.config.file-extension=properties", "spring.cloud.nacos.config.file-extension=properties",
"spring.cloud.nacos.config.ext-config[0].data-id=ext-config-common01.properties", "spring.cloud.nacos.config.ext-config[0].data-id=ext-config-common01.properties",
"spring.cloud.nacos.config.ext-config[1].data-id=ext-config-common02.properties", "spring.cloud.nacos.config.ext-config[1].data-id=ext-config-common02.properties",
"spring.cloud.nacos.config.ext-config[1].group=GLOBAL_GROUP", "spring.cloud.nacos.config.ext-config[1].group=GLOBAL_GROUP",
"spring.cloud.nacos.config.shared-dataids=common1.properties,common2.properties", "spring.cloud.nacos.config.shared-dataids=common1.properties,common2.properties",
"spring.cloud.nacos.config.accessKey=test-accessKey", "spring.cloud.nacos.config.accessKey=test-accessKey",
"spring.cloud.nacos.config.secretKey=test-secretKey" }, webEnvironment = NONE) "spring.cloud.nacos.config.secretKey=test-secretKey" }, webEnvironment = NONE)
public class NacosConfigurationExtConfigTests { public class NacosConfigurationExtConfigTests {

@ -22,11 +22,8 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Map; import java.util.Map;
import com.alibaba.nacos.client.config.NacosConfigService;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -48,6 +45,8 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import com.alibaba.nacos.client.config.NacosConfigService;
/** /**
* @author xiaojing * @author xiaojing
*/ */
@ -59,7 +58,6 @@ import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(classes = NacosConfigurationTests.TestConfig.class, properties = { @SpringBootTest(classes = NacosConfigurationTests.TestConfig.class, properties = {
"spring.application.name=myTestService1", "spring.profiles.active=dev,test", "spring.application.name=myTestService1", "spring.profiles.active=dev,test",
"spring.cloud.nacos.config.server-addr=127.0.0.1:8848", "spring.cloud.nacos.config.server-addr=127.0.0.1:8848",
"spring.cloud.nacos.config.endpoint=test-endpoint",
"spring.cloud.nacos.config.namespace=test-namespace", "spring.cloud.nacos.config.namespace=test-namespace",
"spring.cloud.nacos.config.encode=utf-8", "spring.cloud.nacos.config.encode=utf-8",
"spring.cloud.nacos.config.timeout=1000", "spring.cloud.nacos.config.timeout=1000",
@ -68,14 +66,10 @@ import org.springframework.test.context.junit4.SpringRunner;
"spring.cloud.nacos.config.cluster-name=test-cluster", "spring.cloud.nacos.config.cluster-name=test-cluster",
"spring.cloud.nacos.config.file-extension=properties", "spring.cloud.nacos.config.file-extension=properties",
"spring.cloud.nacos.config.contextPath=test-contextpath", "spring.cloud.nacos.config.contextPath=test-contextpath",
"spring.cloud.nacos.config.ext-config[0].data-id=ext-config-common01.properties", "spring.cloud.nacos.config.ext-config[0].data-id=ext-config-common01.properties",
"spring.cloud.nacos.config.ext-config[1].data-id=ext-config-common02.properties", "spring.cloud.nacos.config.ext-config[1].data-id=ext-config-common02.properties",
"spring.cloud.nacos.config.ext-config[1].group=GLOBAL_GROUP", "spring.cloud.nacos.config.ext-config[1].group=GLOBAL_GROUP",
"spring.cloud.nacos.config.shared-dataids=common1.properties,common2.properties", "spring.cloud.nacos.config.shared-dataids=common1.properties,common2.properties",
"spring.cloud.nacos.config.accessKey=test-accessKey", "spring.cloud.nacos.config.accessKey=test-accessKey",
"spring.cloud.nacos.config.secretKey=test-secretKey" }, webEnvironment = NONE) "spring.cloud.nacos.config.secretKey=test-secretKey" }, webEnvironment = NONE)
public class NacosConfigurationTests { public class NacosConfigurationTests {
@ -83,8 +77,6 @@ public class NacosConfigurationTests {
static { static {
try { try {
// when(any(ConfigService.class).getConfig(eq("test-name.properties"),
// eq("test-group"), any())).thenReturn("user.name=hello");
Method method = PowerMockito.method(NacosConfigService.class, "getConfig", Method method = PowerMockito.method(NacosConfigService.class, "getConfig",
String.class, String.class, long.class); String.class, String.class, long.class);
@ -152,7 +144,6 @@ public class NacosConfigurationTests {
assertNotNull("NacosConfigProperties was not created", properties); assertNotNull("NacosConfigProperties was not created", properties);
checkoutNacosConfigServerAddr(); checkoutNacosConfigServerAddr();
checkoutNacosConfigEndpoint();
checkoutNacosConfigNamespace(); checkoutNacosConfigNamespace();
checkoutNacosConfigClusterName(); checkoutNacosConfigClusterName();
checkoutNacosConfigAccessKey(); checkoutNacosConfigAccessKey();
@ -172,19 +163,12 @@ public class NacosConfigurationTests {
private void checkoutNacosConfigServerAddr() { private void checkoutNacosConfigServerAddr() {
assertEquals("NacosConfigProperties server address is wrong", "127.0.0.1:8848", assertEquals("NacosConfigProperties server address is wrong", "127.0.0.1:8848",
properties.getServerAddr()); properties.getServerAddr());
} }
private void checkoutNacosConfigEndpoint() {
assertEquals("NacosConfigProperties endpoint is wrong", "test-endpoint",
properties.getEndpoint());
}
private void checkoutNacosConfigNamespace() { private void checkoutNacosConfigNamespace() {
assertEquals("NacosConfigProperties namespace is wrong", "test-namespace", assertEquals("NacosConfigProperties namespace is wrong", "test-namespace",
properties.getNamespace()); properties.getNamespace());
} }
private void checkoutNacosConfigClusterName() { private void checkoutNacosConfigClusterName() {
@ -234,8 +218,8 @@ public class NacosConfigurationTests {
private void checkoutDataLoad() { private void checkoutDataLoad() {
Assert.assertEquals(environment.getProperty("user.name"), "dev"); Assert.assertEquals("dev", environment.getProperty("user.name"));
Assert.assertEquals(environment.getProperty("user.age"), "12"); Assert.assertEquals("12", environment.getProperty("user.age"));
} }
private void checkoutEndpoint() throws Exception { private void checkoutEndpoint() throws Exception {

@ -10,8 +10,8 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-fescar</artifactId> <artifactId>spring-cloud-alibaba-seata</artifactId>
<name>Spring Cloud Alibaba Fescar</name> <name>Spring Cloud Alibaba Seata</name>
<dependencies> <dependencies>

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar; package org.springframework.cloud.alibaba.seata;
import com.alibaba.fescar.spring.annotation.GlobalTransactionScanner; import com.alibaba.fescar.spring.annotation.GlobalTransactionScanner;
@ -29,17 +29,17 @@ import org.springframework.util.StringUtils;
*/ */
@Configuration @Configuration
@EnableConfigurationProperties(FescarProperties.class) @EnableConfigurationProperties(SeataProperties.class)
public class GlobalTransactionAutoConfiguration { public class GlobalTransactionAutoConfiguration {
private final ApplicationContext applicationContext; private final ApplicationContext applicationContext;
private final FescarProperties fescarProperties; private final SeataProperties seataProperties;
public GlobalTransactionAutoConfiguration(ApplicationContext applicationContext, public GlobalTransactionAutoConfiguration(ApplicationContext applicationContext,
FescarProperties fescarProperties) { SeataProperties seataProperties) {
this.applicationContext = applicationContext; this.applicationContext = applicationContext;
this.fescarProperties = fescarProperties; this.seataProperties = seataProperties;
} }
@Bean @Bean
@ -48,11 +48,11 @@ public class GlobalTransactionAutoConfiguration {
String applicationName = applicationContext.getEnvironment() String applicationName = applicationContext.getEnvironment()
.getProperty("spring.application.name"); .getProperty("spring.application.name");
String txServiceGroup = fescarProperties.getTxServiceGroup(); String txServiceGroup = seataProperties.getTxServiceGroup();
if (StringUtils.isEmpty(txServiceGroup)) { if (StringUtils.isEmpty(txServiceGroup)) {
txServiceGroup = applicationName + "-fescar-service-group"; txServiceGroup = applicationName + "-fescar-service-group";
fescarProperties.setTxServiceGroup(txServiceGroup); seataProperties.setTxServiceGroup(txServiceGroup);
} }
return new GlobalTransactionScanner(applicationName, txServiceGroup); return new GlobalTransactionScanner(applicationName, txServiceGroup);

@ -14,20 +14,20 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar; package org.springframework.cloud.alibaba.seata;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
/** /**
* @author xiaojing * @author xiaojing
*/ */
@ConfigurationProperties("spring.cloud.alibaba.fescar") @ConfigurationProperties("spring.cloud.alibaba.seata")
public class FescarProperties { public class SeataProperties {
// todo support config Fescar server information // todo support config Fescar server information
/** /**
* Fescar tx service group.default is ${spring.application.name}-fescar-service-group. * Seata tx service group.default is ${spring.application.name}-fescar-service-group.
*/ */
private String txServiceGroup; private String txServiceGroup;

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar.feign; package org.springframework.cloud.alibaba.seata.feign;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.beans.factory.config.BeanPostProcessor;
@ -22,18 +22,18 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
/** /**
* @author xiaojing * @author xiaojing
*/ */
final class FescarBeanPostProcessor implements BeanPostProcessor { final class SeataBeanPostProcessor implements BeanPostProcessor {
private final FescarFeignObjectWrapper fescarFeignObjectWrapper; private final SeataFeignObjectWrapper seataFeignObjectWrapper;
FescarBeanPostProcessor(FescarFeignObjectWrapper fescarFeignObjectWrapper) { SeataBeanPostProcessor(SeataFeignObjectWrapper seataFeignObjectWrapper) {
this.fescarFeignObjectWrapper = fescarFeignObjectWrapper; this.seataFeignObjectWrapper = seataFeignObjectWrapper;
} }
@Override @Override
public Object postProcessBeforeInitialization(Object bean, String beanName) public Object postProcessBeforeInitialization(Object bean, String beanName)
throws BeansException { throws BeansException {
return this.fescarFeignObjectWrapper.wrap(bean); return this.seataFeignObjectWrapper.wrap(bean);
} }
@Override @Override

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar.feign; package org.springframework.cloud.alibaba.seata.feign;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactory;
@ -24,20 +24,20 @@ import org.springframework.cloud.openfeign.FeignContext;
/** /**
* @author xiaojing * @author xiaojing
*/ */
public class FescarContextBeanPostProcessor implements BeanPostProcessor { public class SeataContextBeanPostProcessor implements BeanPostProcessor {
private final BeanFactory beanFactory; private final BeanFactory beanFactory;
private FescarFeignObjectWrapper fescarFeignObjectWrapper; private SeataFeignObjectWrapper seataFeignObjectWrapper;
FescarContextBeanPostProcessor(BeanFactory beanFactory) { SeataContextBeanPostProcessor(BeanFactory beanFactory) {
this.beanFactory = beanFactory; this.beanFactory = beanFactory;
} }
@Override @Override
public Object postProcessBeforeInitialization(Object bean, String beanName) public Object postProcessBeforeInitialization(Object bean, String beanName)
throws BeansException { throws BeansException {
if (bean instanceof FeignContext && !(bean instanceof FescarFeignContext)) { if (bean instanceof FeignContext && !(bean instanceof SeataFeignContext)) {
return new FescarFeignContext(getFescarFeignObjectWrapper(), return new SeataFeignContext(getSeataFeignObjectWrapper(),
(FeignContext) bean); (FeignContext) bean);
} }
return bean; return bean;
@ -49,11 +49,11 @@ public class FescarContextBeanPostProcessor implements BeanPostProcessor {
return bean; return bean;
} }
private FescarFeignObjectWrapper getFescarFeignObjectWrapper() { private SeataFeignObjectWrapper getSeataFeignObjectWrapper() {
if (this.fescarFeignObjectWrapper == null) { if (this.seataFeignObjectWrapper == null) {
this.fescarFeignObjectWrapper = this.beanFactory this.seataFeignObjectWrapper = this.beanFactory
.getBean(FescarFeignObjectWrapper.class); .getBean(SeataFeignObjectWrapper.class);
} }
return this.fescarFeignObjectWrapper; return this.seataFeignObjectWrapper;
} }
} }

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar.feign; package org.springframework.cloud.alibaba.seata.feign;
import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactory;
@ -23,12 +23,12 @@ import feign.Feign;
/** /**
* @author xiaojing * @author xiaojing
*/ */
final class FescarFeignBuilder { final class SeataFeignBuilder {
private FescarFeignBuilder() { private SeataFeignBuilder() {
} }
static Feign.Builder builder(BeanFactory beanFactory) { static Feign.Builder builder(BeanFactory beanFactory) {
return Feign.builder().client(new FescarFeignClient(beanFactory)); return Feign.builder().client(new SeataFeignClient(beanFactory));
} }
} }

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar.feign; package org.springframework.cloud.alibaba.seata.feign;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -35,17 +35,17 @@ import org.springframework.util.StringUtils;
/** /**
* @author xiaojing * @author xiaojing
*/ */
public class FescarFeignClient implements Client { public class SeataFeignClient implements Client {
private final Client delegate; private final Client delegate;
private final BeanFactory beanFactory; private final BeanFactory beanFactory;
FescarFeignClient(BeanFactory beanFactory) { SeataFeignClient(BeanFactory beanFactory) {
this.beanFactory = beanFactory; this.beanFactory = beanFactory;
this.delegate = new Client.Default(null, null); this.delegate = new Client.Default(null, null);
} }
FescarFeignClient(BeanFactory beanFactory, Client delegate) { SeataFeignClient(BeanFactory beanFactory, Client delegate) {
this.delegate = delegate; this.delegate = delegate;
this.beanFactory = beanFactory; this.beanFactory = beanFactory;
} }

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar.feign; package org.springframework.cloud.alibaba.seata.feign;
import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactory;
import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.AutoConfigureBefore;
@ -36,14 +36,14 @@ import feign.Feign;
@Configuration @Configuration
@ConditionalOnClass(Client.class) @ConditionalOnClass(Client.class)
@AutoConfigureBefore(FeignAutoConfiguration.class) @AutoConfigureBefore(FeignAutoConfiguration.class)
public class FescarFeignClientAutoConfiguration { public class SeataFeignClientAutoConfiguration {
@Bean @Bean
@Scope("prototype") @Scope("prototype")
@ConditionalOnClass(name = "com.netflix.hystrix.HystrixCommand") @ConditionalOnClass(name = "com.netflix.hystrix.HystrixCommand")
@ConditionalOnProperty(name = "feign.hystrix.enabled", havingValue = "true") @ConditionalOnProperty(name = "feign.hystrix.enabled", havingValue = "true")
Feign.Builder feignHystrixBuilder(BeanFactory beanFactory) { Feign.Builder feignHystrixBuilder(BeanFactory beanFactory) {
return FescarHystrixFeignBuilder.builder(beanFactory); return SeataHystrixFeignBuilder.builder(beanFactory);
} }
@Bean @Bean
@ -51,34 +51,34 @@ public class FescarFeignClientAutoConfiguration {
@ConditionalOnClass(name = "com.alibaba.csp.sentinel.SphU") @ConditionalOnClass(name = "com.alibaba.csp.sentinel.SphU")
@ConditionalOnProperty(name = "feign.sentinel.enabled", havingValue = "true") @ConditionalOnProperty(name = "feign.sentinel.enabled", havingValue = "true")
Feign.Builder feignSentinelBuilder(BeanFactory beanFactory) { Feign.Builder feignSentinelBuilder(BeanFactory beanFactory) {
return FescarSentinelFeignBuilder.builder(beanFactory); return SeataSentinelFeignBuilder.builder(beanFactory);
} }
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
@Scope("prototype") @Scope("prototype")
Feign.Builder feignBuilder(BeanFactory beanFactory) { Feign.Builder feignBuilder(BeanFactory beanFactory) {
return FescarFeignBuilder.builder(beanFactory); return SeataFeignBuilder.builder(beanFactory);
} }
@Configuration @Configuration
protected static class FeignBeanPostProcessorConfiguration { protected static class FeignBeanPostProcessorConfiguration {
@Bean @Bean
FescarBeanPostProcessor fescarBeanPostProcessor( SeataBeanPostProcessor fescarBeanPostProcessor(
FescarFeignObjectWrapper fescarFeignObjectWrapper) { SeataFeignObjectWrapper seataFeignObjectWrapper) {
return new FescarBeanPostProcessor(fescarFeignObjectWrapper); return new SeataBeanPostProcessor(seataFeignObjectWrapper);
} }
@Bean @Bean
FescarContextBeanPostProcessor fescarContextBeanPostProcessor( SeataContextBeanPostProcessor fescarContextBeanPostProcessor(
BeanFactory beanFactory) { BeanFactory beanFactory) {
return new FescarContextBeanPostProcessor(beanFactory); return new SeataContextBeanPostProcessor(beanFactory);
} }
@Bean @Bean
FescarFeignObjectWrapper fescarFeignObjectWrapper(BeanFactory beanFactory) { SeataFeignObjectWrapper fescarFeignObjectWrapper(BeanFactory beanFactory) {
return new FescarFeignObjectWrapper(beanFactory); return new SeataFeignObjectWrapper(beanFactory);
} }
} }

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar.feign; package org.springframework.cloud.alibaba.seata.feign;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -26,14 +26,14 @@ import org.springframework.cloud.openfeign.FeignContext;
* *
* @author xiaojing * @author xiaojing
*/ */
public class FescarFeignContext extends FeignContext { public class SeataFeignContext extends FeignContext {
private final FescarFeignObjectWrapper fescarFeignObjectWrapper; private final SeataFeignObjectWrapper seataFeignObjectWrapper;
private final FeignContext delegate; private final FeignContext delegate;
FescarFeignContext(FescarFeignObjectWrapper fescarFeignObjectWrapper, SeataFeignContext(SeataFeignObjectWrapper seataFeignObjectWrapper,
FeignContext delegate) { FeignContext delegate) {
this.fescarFeignObjectWrapper = fescarFeignObjectWrapper; this.seataFeignObjectWrapper = seataFeignObjectWrapper;
this.delegate = delegate; this.delegate = delegate;
} }
@ -43,7 +43,7 @@ public class FescarFeignContext extends FeignContext {
if (object instanceof Client) { if (object instanceof Client) {
return object; return object;
} }
return (T) this.fescarFeignObjectWrapper.wrap(object); return (T) this.seataFeignObjectWrapper.wrap(object);
} }
@Override @Override
@ -59,7 +59,7 @@ public class FescarFeignContext extends FeignContext {
} }
else { else {
convertedInstances.put(entry.getKey(), convertedInstances.put(entry.getKey(),
(T) this.fescarFeignObjectWrapper.wrap(entry.getValue())); (T) this.seataFeignObjectWrapper.wrap(entry.getValue()));
} }
} }
return convertedInstances; return convertedInstances;

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar.feign; package org.springframework.cloud.alibaba.seata.feign;
import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactory;
import org.springframework.cloud.netflix.ribbon.SpringClientFactory; import org.springframework.cloud.netflix.ribbon.SpringClientFactory;
@ -26,25 +26,25 @@ import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient;
/** /**
* @author xiaojing * @author xiaojing
*/ */
public class FescarFeignObjectWrapper { public class SeataFeignObjectWrapper {
private final BeanFactory beanFactory; private final BeanFactory beanFactory;
private CachingSpringLoadBalancerFactory cachingSpringLoadBalancerFactory; private CachingSpringLoadBalancerFactory cachingSpringLoadBalancerFactory;
private SpringClientFactory springClientFactory; private SpringClientFactory springClientFactory;
FescarFeignObjectWrapper(BeanFactory beanFactory) { SeataFeignObjectWrapper(BeanFactory beanFactory) {
this.beanFactory = beanFactory; this.beanFactory = beanFactory;
} }
Object wrap(Object bean) { Object wrap(Object bean) {
if (bean instanceof Client && !(bean instanceof FescarFeignClient)) { if (bean instanceof Client && !(bean instanceof SeataFeignClient)) {
if (bean instanceof LoadBalancerFeignClient) { if (bean instanceof LoadBalancerFeignClient) {
LoadBalancerFeignClient client = ((LoadBalancerFeignClient) bean); LoadBalancerFeignClient client = ((LoadBalancerFeignClient) bean);
return new FescarLoadBalancerFeignClient(client.getDelegate(), factory(), return new SeataLoadBalancerFeignClient(client.getDelegate(), factory(),
clientFactory(), this.beanFactory); clientFactory(), this.beanFactory);
} }
return new FescarFeignClient(this.beanFactory, (Client) bean); return new SeataFeignClient(this.beanFactory, (Client) bean);
} }
return bean; return bean;
} }

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar.feign; package org.springframework.cloud.alibaba.seata.feign;
import feign.Retryer; import feign.Retryer;
import feign.hystrix.HystrixFeign; import feign.hystrix.HystrixFeign;
@ -25,13 +25,13 @@ import feign.Feign;
/** /**
* @author xiaojing * @author xiaojing
*/ */
final class FescarHystrixFeignBuilder { final class SeataHystrixFeignBuilder {
private FescarHystrixFeignBuilder() { private SeataHystrixFeignBuilder() {
} }
static Feign.Builder builder(BeanFactory beanFactory) { static Feign.Builder builder(BeanFactory beanFactory) {
return HystrixFeign.builder().retryer(Retryer.NEVER_RETRY) return HystrixFeign.builder().retryer(Retryer.NEVER_RETRY)
.client(new FescarFeignClient(beanFactory)); .client(new SeataFeignClient(beanFactory));
} }
} }

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar.feign; package org.springframework.cloud.alibaba.seata.feign;
import java.io.IOException; import java.io.IOException;
@ -30,13 +30,13 @@ import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient;
/** /**
* @author xiaojing * @author xiaojing
*/ */
public class FescarLoadBalancerFeignClient extends LoadBalancerFeignClient { public class SeataLoadBalancerFeignClient extends LoadBalancerFeignClient {
private final BeanFactory beanFactory; private final BeanFactory beanFactory;
FescarLoadBalancerFeignClient(Client delegate, SeataLoadBalancerFeignClient(Client delegate,
CachingSpringLoadBalancerFactory lbClientFactory, CachingSpringLoadBalancerFactory lbClientFactory,
SpringClientFactory clientFactory, BeanFactory beanFactory) { SpringClientFactory clientFactory, BeanFactory beanFactory) {
super(wrap(delegate, beanFactory), lbClientFactory, clientFactory); super(wrap(delegate, beanFactory), lbClientFactory, clientFactory);
this.beanFactory = beanFactory; this.beanFactory = beanFactory;
} }
@ -47,7 +47,7 @@ public class FescarLoadBalancerFeignClient extends LoadBalancerFeignClient {
} }
private static Client wrap(Client delegate, BeanFactory beanFactory) { private static Client wrap(Client delegate, BeanFactory beanFactory) {
return (Client) new FescarFeignObjectWrapper(beanFactory).wrap(delegate); return (Client) new SeataFeignObjectWrapper(beanFactory).wrap(delegate);
} }
} }

@ -14,26 +14,24 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar.feign; package org.springframework.cloud.alibaba.seata.feign;
import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactory;
import feign.Feign; import feign.Feign;
import feign.Retryer; import feign.Retryer;
import feign.hystrix.HystrixFeign;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties.Sentinel;
import org.springframework.cloud.alibaba.sentinel.feign.SentinelFeign; import org.springframework.cloud.alibaba.sentinel.feign.SentinelFeign;
/** /**
* @author xiaojing * @author xiaojing
*/ */
final class FescarSentinelFeignBuilder { final class SeataSentinelFeignBuilder {
private FescarSentinelFeignBuilder() { private SeataSentinelFeignBuilder() {
} }
static Feign.Builder builder(BeanFactory beanFactory) { static Feign.Builder builder(BeanFactory beanFactory) {
return SentinelFeign.builder().retryer(Retryer.NEVER_RETRY) return SentinelFeign.builder().retryer(Retryer.NEVER_RETRY)
.client(new FescarFeignClient(beanFactory)); .client(new SeataFeignClient(beanFactory));
} }
} }

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar.feign.hystrix; package org.springframework.cloud.alibaba.seata.feign.hystrix;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@ -27,11 +27,11 @@ import com.netflix.hystrix.HystrixCommand;
@Configuration @Configuration
@ConditionalOnClass(HystrixCommand.class) @ConditionalOnClass(HystrixCommand.class)
public class FescarHystrixAutoConfiguration { public class SeataHystrixAutoConfiguration {
@Bean @Bean
FescarHystrixConcurrencyStrategy fescarHystrixConcurrencyStrategy() { SeataHystrixConcurrencyStrategy fescarHystrixConcurrencyStrategy() {
return new FescarHystrixConcurrencyStrategy(); return new SeataHystrixConcurrencyStrategy();
} }
} }

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar.feign.hystrix; package org.springframework.cloud.alibaba.seata.feign.hystrix;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
@ -25,11 +25,11 @@ import com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy;
/** /**
* @author xiaojing * @author xiaojing
*/ */
public class FescarHystrixConcurrencyStrategy extends HystrixConcurrencyStrategy { public class SeataHystrixConcurrencyStrategy extends HystrixConcurrencyStrategy {
private HystrixConcurrencyStrategy delegate; private HystrixConcurrencyStrategy delegate;
public FescarHystrixConcurrencyStrategy() { public SeataHystrixConcurrencyStrategy() {
this.delegate = HystrixPlugins.getInstance().getConcurrencyStrategy(); this.delegate = HystrixPlugins.getInstance().getConcurrencyStrategy();
HystrixPlugins.reset(); HystrixPlugins.reset();
HystrixPlugins.getInstance().registerConcurrencyStrategy(this); HystrixPlugins.getInstance().registerConcurrencyStrategy(this);

@ -29,7 +29,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar.rest; package org.springframework.cloud.alibaba.seata.rest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@ -47,18 +47,18 @@ import java.util.List;
*/ */
@Configuration @Configuration
public class FescarRestTemplateAutoConfiguration { public class SeataRestTemplateAutoConfiguration {
@Bean @Bean
public FescarRestTemplateInterceptor fescarRestTemplateInterceptor() { public SeataRestTemplateInterceptor fescarRestTemplateInterceptor() {
return new FescarRestTemplateInterceptor(); return new SeataRestTemplateInterceptor();
} }
@Autowired(required = false) @Autowired(required = false)
private Collection<RestTemplate> restTemplates; private Collection<RestTemplate> restTemplates;
@Autowired @Autowired
private FescarRestTemplateInterceptor fescarRestTemplateInterceptor; private SeataRestTemplateInterceptor seataRestTemplateInterceptor;
@PostConstruct @PostConstruct
public void init() { public void init() {
@ -66,7 +66,7 @@ public class FescarRestTemplateAutoConfiguration {
for (RestTemplate restTemplate : restTemplates) { for (RestTemplate restTemplate : restTemplates) {
List<ClientHttpRequestInterceptor> interceptors = new ArrayList<ClientHttpRequestInterceptor>( List<ClientHttpRequestInterceptor> interceptors = new ArrayList<ClientHttpRequestInterceptor>(
restTemplate.getInterceptors()); restTemplate.getInterceptors());
interceptors.add(this.fescarRestTemplateInterceptor); interceptors.add(this.seataRestTemplateInterceptor);
restTemplate.setInterceptors(interceptors); restTemplate.setInterceptors(interceptors);
} }
} }

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar.rest; package org.springframework.cloud.alibaba.seata.rest;
import java.io.IOException; import java.io.IOException;
@ -30,7 +30,7 @@ import org.springframework.util.StringUtils;
/** /**
* @author xiaojing * @author xiaojing
*/ */
public class FescarRestTemplateInterceptor implements ClientHttpRequestInterceptor { public class SeataRestTemplateInterceptor implements ClientHttpRequestInterceptor {
@Override @Override
public ClientHttpResponse intercept(HttpRequest httpRequest, byte[] bytes, public ClientHttpResponse intercept(HttpRequest httpRequest, byte[] bytes,
ClientHttpRequestExecution clientHttpRequestExecution) throws IOException { ClientHttpRequestExecution clientHttpRequestExecution) throws IOException {

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar.web; package org.springframework.cloud.alibaba.seata.web;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -35,10 +35,10 @@ import org.springframework.web.servlet.HandlerInterceptor;
* And clean up Fescar information after servlet method invocation in * And clean up Fescar information after servlet method invocation in
* {@link org.springframework.web.servlet.HandlerInterceptor#afterCompletion(HttpServletRequest, HttpServletResponse, Object, Exception)} * {@link org.springframework.web.servlet.HandlerInterceptor#afterCompletion(HttpServletRequest, HttpServletResponse, Object, Exception)}
*/ */
public class FescarHandlerInterceptor implements HandlerInterceptor { public class SeataHandlerInterceptor implements HandlerInterceptor {
private static final Logger log = LoggerFactory private static final Logger log = LoggerFactory
.getLogger(FescarHandlerInterceptor.class); .getLogger(SeataHandlerInterceptor.class);
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, public boolean preHandle(HttpServletRequest request, HttpServletResponse response,

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.alibaba.fescar.web; package org.springframework.cloud.alibaba.seata.web;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@ -22,10 +22,10 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/** /**
* @author xiaojing * @author xiaojing
*/ */
public class FescarHandlerInterceptorConfiguration implements WebMvcConfigurer { public class SeataHandlerInterceptorConfiguration implements WebMvcConfigurer {
@Override @Override
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new FescarHandlerInterceptor()).addPathPatterns("/**"); registry.addInterceptor(new SeataHandlerInterceptor()).addPathPatterns("/**");
} }
} }

@ -0,0 +1,7 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.springframework.cloud.alibaba.seata.rest.SeataRestTemplateAutoConfiguration,\
org.springframework.cloud.alibaba.seata.web.SeataHandlerInterceptorConfiguration,\
org.springframework.cloud.alibaba.seata.GlobalTransactionAutoConfiguration,\
org.springframework.cloud.alibaba.seata.feign.SeataFeignClientAutoConfiguration,\
org.springframework.cloud.alibaba.seata.feign.hystrix.SeataHystrixAutoConfiguration

@ -16,7 +16,7 @@
<module>spring-cloud-starter-alibaba-nacos-config-server</module> <module>spring-cloud-starter-alibaba-nacos-config-server</module>
<module>spring-cloud-starter-alibaba-nacos-discovery</module> <module>spring-cloud-starter-alibaba-nacos-discovery</module>
<module>spring-cloud-starter-alibaba-sentinel</module> <module>spring-cloud-starter-alibaba-sentinel</module>
<module>spring-cloud-starter-alibaba-fescar</module> <module>spring-cloud-starter-alibaba-seata</module>
<module>spring-cloud-starter-stream-rocketmq</module> <module>spring-cloud-starter-stream-rocketmq</module>
<module>spring-cloud-starter-bus-rocketmq</module> <module>spring-cloud-starter-bus-rocketmq</module>
<module>spring-cloud-starter-dubbo</module> <module>spring-cloud-starter-dubbo</module>

@ -7,13 +7,13 @@
<artifactId>spring-cloud-starter-alibaba</artifactId> <artifactId>spring-cloud-starter-alibaba</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version> <version>2.1.0.BUILD-SNAPSHOT</version>
</parent> </parent>
<artifactId>spring-cloud-starter-alibaba-fescar</artifactId> <artifactId>spring-cloud-starter-alibaba-seata</artifactId>
<name>Spring Cloud Starter Alibaba Fescar</name> <name>Spring Cloud Starter Alibaba Seata</name>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-fescar</artifactId> <artifactId>spring-cloud-alibaba-seata</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
Loading…
Cancel
Save