1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

rename fescar to seata

This commit is contained in:
flystar32 2019-04-16 21:17:23 +08:00
parent 2a3ff1725a
commit 67bbfc1ed6
56 changed files with 125 additions and 127 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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 侵入 的方式,解决 微服务 场景下面临的分布式事务问题。

View File

@ -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>

View File

@ -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

View File

@ -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>

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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;
} }
} }

View File

@ -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));
} }
} }

View File

@ -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;
} }

View File

@ -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);
} }
} }

View File

@ -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;

View File

@ -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;
} }

View File

@ -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));
} }
} }

View File

@ -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);
} }
} }

View File

@ -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));
} }
} }

View File

@ -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();
} }
} }

View File

@ -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);

View File

@ -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);
} }
} }

View File

@ -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 {

View File

@ -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,

View File

@ -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("/**");
} }
} }

View File

@ -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

View File

@ -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>

View File

@ -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>