diff --git a/README.md b/README.md index 20d4894..da809a7 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ gitee项目地址:[https://gitee.com/lianjiatech/retrofit-spring-boot-starter] com.github.lianjiatech retrofit-spring-boot-starter - 2.2.17 + 2.2.18 ``` @@ -67,7 +67,7 @@ gitee项目地址:[https://gitee.com/lianjiatech/retrofit-spring-boot-starter] com.github.lianjiatech retrofit-spring-boot-starter - 2.2.17 + 2.2.18 com.squareup.okhttp3 diff --git a/README_EN.md b/README_EN.md index 835aef6..1a6e005 100644 --- a/README_EN.md +++ b/README_EN.md @@ -43,7 +43,7 @@ com.github.lianjiatech retrofit-spring-boot-starter - 2.2.17 + 2.2.18 ``` @@ -53,7 +53,7 @@ This project depends on Retrofit-2.9.0, okhttp-3.14.9, and okio-1.17.5 versions. com.github.lianjiatech retrofit-spring-boot-starter - 2.2.17 + 2.2.18 com.squareup.okhttp3 diff --git a/pom.xml b/pom.xml index af248be..986dfa2 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.github.lianjiatech retrofit-spring-boot-starter - 2.2.17 + 2.2.18 retrofit-spring-boot-starter retrofit-spring-boot-starter diff --git a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/core/RetrofitInvocationHandler.java b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/core/RetrofitInvocationHandler.java index 4f8fac6..7909271 100644 --- a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/core/RetrofitInvocationHandler.java +++ b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/core/RetrofitInvocationHandler.java @@ -35,10 +35,12 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl return method.invoke(source, args); } catch (Throwable e) { Throwable cause = e.getCause(); - Object fallbackObject = getFallbackObject(cause); // 熔断逻辑 - if (cause instanceof RetrofitBlockException && degradeProperty.isEnable() && fallbackObject != null) { - return method.invoke(fallbackObject, args); + if (cause instanceof RetrofitBlockException && degradeProperty.isEnable()) { + Object fallbackObject = getFallbackObject(cause); + if (fallbackObject != null) { + return method.invoke(fallbackObject, args); + } } throw cause; }