diff --git a/pigx-common/pigx-common-bom/pom.xml b/pigx-common/pigx-common-bom/pom.xml
index 3633c4bd9..6f5cbdc4b 100644
--- a/pigx-common/pigx-common-bom/pom.xml
+++ b/pigx-common/pigx-common-bom/pom.xml
@@ -4,9 +4,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- pigx-cloud-dependencies-parent
- com.pig4cloud
- Hoxton.SR9
+ group.springframework
+ spring-cloud-dependencies-parent
+ 2020.0.0
@@ -18,7 +18,7 @@
4.0.0-SNAPSHOT
- 3.4.1
+ 3.4.2
3.2.0
1.2.4
8.0.22
@@ -32,7 +32,7 @@
3.0.52.ALL
0.0.23
0.33.0
- 1.1.1
+ 1.0.0
@@ -216,40 +216,6 @@
-
-
-
-
- com.pig4cloud.plugin
- spring-cloud-maven-plugin
- ${cloud.plugin.version}
-
-
- package
-
- info
-
-
-
-
-
-
- io.fabric8
- docker-maven-plugin
- ${docker.plugin.version}
-
- true
-
-
-
-
- io.spring.javaformat
- spring-javaformat-maven-plugin
- ${javaformat.plugin.version}
-
-
-
-
aliyun-plugin
diff --git a/pigx-common/pigx-common-data/src/main/java/com/pig4cloud/pigx/common/data/cache/RedisTemplateConfig.java b/pigx-common/pigx-common-data/src/main/java/com/pig4cloud/pigx/common/data/cache/RedisTemplateConfig.java
index 68668851e..a48393102 100644
--- a/pigx-common/pigx-common-data/src/main/java/com/pig4cloud/pigx/common/data/cache/RedisTemplateConfig.java
+++ b/pigx-common/pigx-common-data/src/main/java/com/pig4cloud/pigx/common/data/cache/RedisTemplateConfig.java
@@ -36,8 +36,8 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
@EnableCaching
@Configuration
@AllArgsConstructor
-@AutoConfigureBefore(name = {"org.redisson.spring.starter.RedissonAutoConfiguration"
- , "org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration"})
+@AutoConfigureBefore(name = { "org.redisson.spring.starter.RedissonAutoConfiguration",
+ "org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration" })
public class RedisTemplateConfig {
@Bean
diff --git a/pigx-common/pigx-common-sentinel/src/main/java/com/pig4cloud/pigx/common/sentinel/feign/PigxSentinelFeign.java b/pigx-common/pigx-common-sentinel/src/main/java/com/pig4cloud/pigx/common/sentinel/feign/PigxSentinelFeign.java
index 79c1ffd68..e7fc15527 100644
--- a/pigx-common/pigx-common-sentinel/src/main/java/com/pig4cloud/pigx/common/sentinel/feign/PigxSentinelFeign.java
+++ b/pigx-common/pigx-common-sentinel/src/main/java/com/pig4cloud/pigx/common/sentinel/feign/PigxSentinelFeign.java
@@ -1,5 +1,9 @@
package com.pig4cloud.pigx.common.sentinel.feign;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.Map;
+
import com.alibaba.cloud.sentinel.feign.SentinelContractHolder;
import feign.Contract;
import feign.Feign;
@@ -7,17 +11,13 @@ import feign.InvocationHandlerFactory;
import feign.Target;
import org.springframework.beans.BeansException;
import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.FeignContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
-import org.springframework.util.ReflectionUtils;
+import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.util.StringUtils;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.util.Map;
-
/**
* 重写 {@link com.alibaba.cloud.sentinel.feign.SentinelFeign} 支持自动降级注入
*
@@ -58,17 +58,14 @@ public final class PigxSentinelFeign {
super.invocationHandlerFactory(new InvocationHandlerFactory() {
@Override
public InvocationHandler create(Target target, Map dispatch) {
- // using reflect get fallback and fallbackFactory properties from
- // FeignClientFactoryBean because FeignClientFactoryBean is a package
- // level class, we can not use it in our package
- Object feignClientFactoryBean = PigxSentinelFeign.Builder.this.applicationContext
- .getBean("&" + target.type().getName());
+ // 查找 FeignClient 上的 降级策略
+ FeignClient feignClient = AnnotationUtils.findAnnotation(target.type(), FeignClient.class);
+ Class fallback = feignClient.fallback();
+ Class fallbackFactory = feignClient.fallbackFactory();
- Class fallback = (Class) getFieldValue(feignClientFactoryBean, "fallback");
- Class fallbackFactory = (Class) getFieldValue(feignClientFactoryBean, "fallbackFactory");
- String beanName = (String) getFieldValue(feignClientFactoryBean, "contextId");
+ String beanName = feignClient.contextId();
if (!StringUtils.hasText(beanName)) {
- beanName = (String) getFieldValue(feignClientFactoryBean, "name");
+ beanName = feignClient.name();
}
Object fallbackInstance;
@@ -107,18 +104,6 @@ public final class PigxSentinelFeign {
return super.build();
}
- private Object getFieldValue(Object instance, String fieldName) {
- Field field = ReflectionUtils.findField(instance.getClass(), fieldName);
- field.setAccessible(true);
- try {
- return field.get(instance);
- }
- catch (IllegalAccessException e) {
- // ignore
- }
- return null;
- }
-
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
diff --git a/pom.xml b/pom.xml
index 73cdafd68..e63a7b65e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -34,8 +34,8 @@
2.4.1
- 2020.0.0
- 2.2.3.RELEASE
+ 2020.0.1
+ 2.2.5.RELEASE
UTF-8
1.8
1.8
@@ -44,7 +44,7 @@
2.2.5
2.3.1
5.5.7
- 1.2.5
+ 1.2.7
3.0.0
3.0.2
1.7