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

polish #761 update pkg name & maven coordinate for Finchley

This commit is contained in:
fangjian0423
2019-07-23 23:16:42 +08:00
parent 12d4b3f60e
commit c459080f05
652 changed files with 12275 additions and 11471 deletions

View File

@@ -14,9 +14,7 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata;
import io.seata.spring.annotation.GlobalTransactionScanner;
package com.alibaba.cloud.seata;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationContext;
@@ -24,6 +22,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils;
import io.seata.spring.annotation.GlobalTransactionScanner;
/**
* @author xiaojing
*/

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata;
package com.alibaba.cloud.seata;
import org.springframework.boot.context.properties.ConfigurationProperties;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata.feign;
package com.alibaba.cloud.seata.feign;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata.feign;
package com.alibaba.cloud.seata.feign;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata.feign;
package com.alibaba.cloud.seata.feign;
import org.springframework.beans.factory.BeanFactory;

View File

@@ -0,0 +1,85 @@
/*
* Copyright (C) 2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.cloud.seata.feign;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.util.StringUtils;
import feign.Client;
import feign.Request;
import feign.Response;
import io.seata.core.context.RootContext;
/**
* @author xiaojing
*/
public class SeataFeignClient implements Client {
private final Client delegate;
private final BeanFactory beanFactory;
private static final int MAP_SIZE = 16;
SeataFeignClient(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
this.delegate = new Client.Default(null, null);
}
SeataFeignClient(BeanFactory beanFactory, Client delegate) {
this.delegate = delegate;
this.beanFactory = beanFactory;
}
@Override
public Response execute(Request request, Request.Options options) throws IOException {
Request modifiedRequest = getModifyRequest(request);
try {
return this.delegate.execute(modifiedRequest, options);
}
finally {
}
}
private Request getModifyRequest(Request request) {
String xid = RootContext.getXID();
if (StringUtils.isEmpty(xid)) {
return request;
}
Map<String, Collection<String>> headers = new HashMap<>(MAP_SIZE);
headers.putAll(request.headers());
List<String> fescarXid = new ArrayList<>();
fescarXid.add(xid);
headers.put(RootContext.KEY_XID, fescarXid);
return Request.create(request.method(), request.url(), headers, request.body(),
request.charset());
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata.feign;
package com.alibaba.cloud.seata.feign;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
@@ -65,7 +65,7 @@ public class SeataFeignClientAutoConfiguration {
protected static class FeignBeanPostProcessorConfiguration {
@Bean
SeataBeanPostProcessor seataBeanPostProcessor(
SeataBeanPostProcessor seataBeanPostProcessor(
SeataFeignObjectWrapper seataFeignObjectWrapper) {
return new SeataBeanPostProcessor(seataFeignObjectWrapper);
}

View File

@@ -14,14 +14,15 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata.feign;
package com.alibaba.cloud.seata.feign;
import java.util.HashMap;
import java.util.Map;
import feign.Client;
import org.springframework.cloud.openfeign.FeignContext;
import feign.Client;
/**
*
* @author xiaojing
@@ -32,7 +33,7 @@ public class SeataFeignContext extends FeignContext {
private final FeignContext delegate;
SeataFeignContext(SeataFeignObjectWrapper seataFeignObjectWrapper,
FeignContext delegate) {
FeignContext delegate) {
this.seataFeignObjectWrapper = seataFeignObjectWrapper;
this.delegate = delegate;
}

View File

@@ -14,15 +14,15 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata.feign;
package com.alibaba.cloud.seata.feign;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.cloud.netflix.ribbon.SpringClientFactory;
import feign.Client;
import org.springframework.cloud.openfeign.ribbon.CachingSpringLoadBalancerFactory;
import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient;
import feign.Client;
/**
* @author xiaojing
*/

View File

@@ -14,13 +14,13 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata.feign;
package com.alibaba.cloud.seata.feign;
import feign.Retryer;
import feign.hystrix.HystrixFeign;
import org.springframework.beans.factory.BeanFactory;
import feign.Feign;
import feign.Retryer;
import feign.hystrix.HystrixFeign;
/**
* @author xiaojing

View File

@@ -14,18 +14,18 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata.feign;
package com.alibaba.cloud.seata.feign;
import java.io.IOException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.cloud.netflix.ribbon.SpringClientFactory;
import org.springframework.cloud.openfeign.ribbon.CachingSpringLoadBalancerFactory;
import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient;
import feign.Client;
import feign.Request;
import feign.Response;
import org.springframework.cloud.openfeign.ribbon.CachingSpringLoadBalancerFactory;
import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient;
/**
* @author xiaojing
@@ -35,8 +35,8 @@ public class SeataLoadBalancerFeignClient extends LoadBalancerFeignClient {
private final BeanFactory beanFactory;
SeataLoadBalancerFeignClient(Client delegate,
CachingSpringLoadBalancerFactory lbClientFactory,
SpringClientFactory clientFactory, BeanFactory beanFactory) {
CachingSpringLoadBalancerFactory lbClientFactory,
SpringClientFactory clientFactory, BeanFactory beanFactory) {
super(wrap(delegate, beanFactory), lbClientFactory, clientFactory);
this.beanFactory = beanFactory;
}

View File

@@ -14,13 +14,14 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata.feign;
package com.alibaba.cloud.seata.feign;
import org.springframework.beans.factory.BeanFactory;
import com.alibaba.cloud.sentinel.feign.SentinelFeign;
import feign.Feign;
import feign.Retryer;
import org.springframework.cloud.alibaba.sentinel.feign.SentinelFeign;
/**
* @author xiaojing

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata.feign.hystrix;
package com.alibaba.cloud.seata.feign.hystrix;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;

View File

@@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata.feign.hystrix;
package com.alibaba.cloud.seata.feign.hystrix;
import java.util.concurrent.Callable;
import io.seata.core.context.RootContext;
import com.netflix.hystrix.strategy.HystrixPlugins;
import com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy;
import io.seata.core.context.RootContext;
/**
* @author xiaojing
*/

View File

@@ -29,7 +29,13 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata.rest;
package com.alibaba.cloud.seata.rest;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@@ -37,11 +43,6 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.web.client.RestTemplate;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* @author xiaojing
*/

View File

@@ -14,12 +14,10 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata.rest;
package com.alibaba.cloud.seata.rest;
import java.io.IOException;
import io.seata.core.context.RootContext;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
@@ -27,6 +25,8 @@ import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.client.support.HttpRequestWrapper;
import org.springframework.util.StringUtils;
import io.seata.core.context.RootContext;
/**
* @author xiaojing
*/

View File

@@ -14,18 +14,18 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata.web;
package com.alibaba.cloud.seata.web;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import io.seata.core.context.RootContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.HandlerInterceptor;
import io.seata.core.context.RootContext;
/**
* @author xiaojing
*

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata.web;
package com.alibaba.cloud.seata.web;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

View File

@@ -1,83 +0,0 @@
/*
* Copyright (C) 2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.alibaba.seata.feign;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import feign.Client;
import feign.Request;
import feign.Response;
import io.seata.core.context.RootContext;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.util.StringUtils;
/**
* @author xiaojing
*/
public class SeataFeignClient implements Client {
private final Client delegate;
private final BeanFactory beanFactory;
private static final int MAP_SIZE = 16;
SeataFeignClient(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
this.delegate = new Client.Default(null, null);
}
SeataFeignClient(BeanFactory beanFactory, Client delegate) {
this.delegate = delegate;
this.beanFactory = beanFactory;
}
@Override
public Response execute(Request request, Request.Options options) throws IOException {
Request modifiedRequest = getModifyRequest(request);
try {
return this.delegate.execute(modifiedRequest, options);
} finally {
}
}
private Request getModifyRequest(Request request) {
String xid = RootContext.getXID();
if (StringUtils.isEmpty(xid)) {
return request;
}
Map<String, Collection<String>> headers = new HashMap<>(MAP_SIZE);
headers.putAll(request.headers());
List<String> fescarXid = new ArrayList<>();
fescarXid.add(xid);
headers.put(RootContext.KEY_XID, fescarXid);
return Request.create(request.method(), request.url(), headers, request.body(),
request.charset());
}
}

View File

@@ -1,7 +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
com.alibaba.cloud.seata.rest.SeataRestTemplateAutoConfiguration,\
com.alibaba.cloud.seata.web.SeataHandlerInterceptorConfiguration,\
com.alibaba.cloud.seata.GlobalTransactionAutoConfiguration,\
com.alibaba.cloud.seata.feign.SeataFeignClientAutoConfiguration,\
com.alibaba.cloud.seata.feign.hystrix.SeataHystrixAutoConfiguration