diff --git a/pom.xml b/pom.xml
index a10c697..a89b775 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.github.lianjiatech
retrofit-spring-boot-starter
- 3.0.3
+ 3.1.0
retrofit-spring-boot-starter
retrofit-spring-boot-starter
@@ -37,9 +37,9 @@
- 2.9.0
+ 2.11.0
1.3.2
- 3.1.6
+ 3.2.6
3.14.9
1.6.3
1.18.24
diff --git a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/BaseRetrofitDegrade.java b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/BaseRetrofitDegrade.java
index ad8c634..5d2ece0 100644
--- a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/BaseRetrofitDegrade.java
+++ b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/BaseRetrofitDegrade.java
@@ -1,16 +1,15 @@
package com.github.lianjiatech.retrofit.spring.boot.degrade;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
+import com.github.lianjiatech.retrofit.spring.boot.core.RetrofitClient;
+import com.github.lianjiatech.retrofit.spring.boot.util.RetrofitUtils;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.core.env.Environment;
-import com.github.lianjiatech.retrofit.spring.boot.core.RetrofitClient;
-import com.github.lianjiatech.retrofit.spring.boot.util.RetrofitUtils;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
/**
* @author 陈添明
@@ -25,13 +24,13 @@ public abstract class BaseRetrofitDegrade implements RetrofitDegrade, ResourceNa
protected Environment environment;
@Override
- public String parseResourceName(Method method) {
+ public String parseResourceName(Method method, Class> service) {
String resourceName = RESOURCE_NAME_CACHE.get(method);
if (resourceName != null) {
return resourceName;
}
RetrofitClient retrofitClient =
- AnnotatedElementUtils.findMergedAnnotation(method.getDeclaringClass(), RetrofitClient.class);
+ AnnotatedElementUtils.findMergedAnnotation(service, RetrofitClient.class);
String baseUrl = RetrofitUtils.convertBaseUrl(retrofitClient, retrofitClient.baseUrl(), environment);
HttpMethodPath httpMethodPath = parseHttpMethodPath(method);
resourceName = formatResourceName(baseUrl, httpMethodPath);
diff --git a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/ResourceNameParser.java b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/ResourceNameParser.java
index 4fc2201..fdc6f42 100644
--- a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/ResourceNameParser.java
+++ b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/ResourceNameParser.java
@@ -1,14 +1,8 @@
package com.github.lianjiatech.retrofit.spring.boot.degrade;
-import java.lang.reflect.Method;
+import retrofit2.http.*;
-import retrofit2.http.DELETE;
-import retrofit2.http.GET;
-import retrofit2.http.HEAD;
-import retrofit2.http.HTTP;
-import retrofit2.http.PATCH;
-import retrofit2.http.POST;
-import retrofit2.http.PUT;
+import java.lang.reflect.Method;
/**
* @author 陈添明
@@ -18,11 +12,12 @@ public interface ResourceNameParser {
/**
* 解析资源名称
- * @param method 方法
*
+ * @param method 方法
+ * @param service 接口类
* @return 资源名称
*/
- String parseResourceName(Method method);
+ String parseResourceName(Method method, Class> service);
/**
* 解析方法路径
diff --git a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/resilience4j/Resilience4jRetrofitDegrade.java b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/resilience4j/Resilience4jRetrofitDegrade.java
index e10285b..879a63a 100644
--- a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/resilience4j/Resilience4jRetrofitDegrade.java
+++ b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/resilience4j/Resilience4jRetrofitDegrade.java
@@ -1,25 +1,22 @@
package com.github.lianjiatech.retrofit.spring.boot.degrade.resilience4j;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.util.Objects;
-import java.util.concurrent.TimeUnit;
-
-import com.github.lianjiatech.retrofit.spring.boot.util.RetrofitUtils;
-import org.springframework.core.annotation.AnnotatedElementUtils;
-
import com.github.lianjiatech.retrofit.spring.boot.degrade.BaseRetrofitDegrade;
import com.github.lianjiatech.retrofit.spring.boot.degrade.RetrofitBlockException;
import com.github.lianjiatech.retrofit.spring.boot.util.AnnotationExtendUtils;
-
import io.github.resilience4j.circuitbreaker.CallNotPermittedException;
import io.github.resilience4j.circuitbreaker.CircuitBreaker;
import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry;
import io.github.resilience4j.core.StopWatch;
import okhttp3.Request;
import okhttp3.Response;
+import org.springframework.core.annotation.AnnotatedElementUtils;
import retrofit2.Invocation;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.Objects;
+import java.util.concurrent.TimeUnit;
+
/**
* @author 陈添明
* @since 2022/5/1 8:02 下午
@@ -59,15 +56,14 @@ public void loadDegradeRules(Class> retrofitInterface) {
continue;
}
Resilience4jDegrade resilience4jDegrade =
- AnnotationExtendUtils.findMergedAnnotation(method, method.getDeclaringClass(),
- Resilience4jDegrade.class);
+ AnnotationExtendUtils.findMergedAnnotation(method, retrofitInterface, Resilience4jDegrade.class);
if (!needDegrade(resilience4jDegrade)) {
continue;
}
String circuitBreakerConfigName =
resilience4jDegrade == null ? globalResilience4jDegradeProperty.getCircuitBreakerConfigName()
: resilience4jDegrade.circuitBreakerConfigName();
- circuitBreakerRegistry.circuitBreaker(parseResourceName(method),
+ circuitBreakerRegistry.circuitBreaker(parseResourceName(method, retrofitInterface),
circuitBreakerConfigRegistry.get(circuitBreakerConfigName));
}
}
@@ -86,12 +82,12 @@ protected boolean needDegrade(Resilience4jDegrade resilience4jDegrade) {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
- Method method = RetrofitUtils.getMethodFormRequest(request);
- if (method == null) {
+ Invocation invocation = request.tag(Invocation.class);
+ if (invocation == null) {
return chain.proceed(request);
}
CircuitBreaker circuitBreaker =
- circuitBreakerRegistry.find(parseResourceName(method)).orElse(null);
+ circuitBreakerRegistry.find(parseResourceName(invocation.method(), invocation.service())).orElse(null);
if (Objects.isNull(circuitBreaker)) {
// 断路器为空则直接调用返回
return chain.proceed(request);
diff --git a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/sentinel/SentinelRetrofitDegrade.java b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/sentinel/SentinelRetrofitDegrade.java
index 9504bb7..d2685af 100644
--- a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/sentinel/SentinelRetrofitDegrade.java
+++ b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/sentinel/SentinelRetrofitDegrade.java
@@ -1,29 +1,21 @@
package com.github.lianjiatech.retrofit.spring.boot.degrade.sentinel;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.util.Collections;
-import java.util.Objects;
-
-import com.github.lianjiatech.retrofit.spring.boot.util.RetrofitUtils;
-import org.springframework.core.annotation.AnnotatedElementUtils;
-
-import com.alibaba.csp.sentinel.Entry;
-import com.alibaba.csp.sentinel.EntryType;
-import com.alibaba.csp.sentinel.ResourceTypeConstants;
-import com.alibaba.csp.sentinel.SphU;
-import com.alibaba.csp.sentinel.Tracer;
+import com.alibaba.csp.sentinel.*;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.alibaba.csp.sentinel.slots.block.degrade.DegradeRule;
import com.alibaba.csp.sentinel.slots.block.degrade.DegradeRuleManager;
import com.github.lianjiatech.retrofit.spring.boot.degrade.BaseRetrofitDegrade;
import com.github.lianjiatech.retrofit.spring.boot.degrade.RetrofitBlockException;
import com.github.lianjiatech.retrofit.spring.boot.util.AnnotationExtendUtils;
-
import okhttp3.Request;
import okhttp3.Response;
+import org.springframework.core.annotation.AnnotatedElementUtils;
import retrofit2.Invocation;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.Collections;
+
/**
* @author 陈添明
*/
@@ -58,7 +50,7 @@ public void loadDegradeRules(Class> retrofitInterface) {
}
// 获取熔断配置
SentinelDegrade sentinelDegrade =
- AnnotationExtendUtils.findMergedAnnotation(method, method.getDeclaringClass(),
+ AnnotationExtendUtils.findMergedAnnotation(method, retrofitInterface,
SentinelDegrade.class);
if (!needDegrade(sentinelDegrade)) {
@@ -71,7 +63,7 @@ public void loadDegradeRules(Class> retrofitInterface) {
: sentinelDegrade.timeWindow())
.setGrade(sentinelDegrade == null ? globalSentinelDegradeProperty.getGrade()
: sentinelDegrade.grade());
- String resourceName = parseResourceName(method);
+ String resourceName = parseResourceName(method, retrofitInterface);
degradeRule.setResource(resourceName);
DegradeRuleManager.setRulesForResource(resourceName, Collections.singleton(degradeRule));
}
@@ -91,16 +83,18 @@ protected boolean needDegrade(SentinelDegrade sentinelDegrade) {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
- Method method = RetrofitUtils.getMethodFormRequest(request);
- if (method == null) {
+ Invocation invocation = request.tag(Invocation.class);
+ if (invocation == null) {
return chain.proceed(request);
}
- SentinelDegrade sentinelDegrade = AnnotationExtendUtils.findMergedAnnotation(method, method.getDeclaringClass(),
+ Method method = invocation.method();
+ Class> service = invocation.service();
+ SentinelDegrade sentinelDegrade = AnnotationExtendUtils.findMergedAnnotation(method, service,
SentinelDegrade.class);
if (!needDegrade(sentinelDegrade)) {
return chain.proceed(request);
}
- String resourceName = parseResourceName(method);
+ String resourceName = parseResourceName(method, service);
Entry entry = null;
try {
entry = SphU.entry(resourceName, ResourceTypeConstants.COMMON_WEB, EntryType.OUT);
diff --git a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/interceptor/ErrorDecoderInterceptor.java b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/interceptor/ErrorDecoderInterceptor.java
index 6606aa5..b01853a 100644
--- a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/interceptor/ErrorDecoderInterceptor.java
+++ b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/interceptor/ErrorDecoderInterceptor.java
@@ -1,25 +1,20 @@
package com.github.lianjiatech.retrofit.spring.boot.interceptor;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.util.Objects;
-
-import com.github.lianjiatech.retrofit.spring.boot.util.RetrofitUtils;
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.core.annotation.AnnotatedElementUtils;
-
import com.github.lianjiatech.retrofit.spring.boot.core.ErrorDecoder;
import com.github.lianjiatech.retrofit.spring.boot.core.RetrofitClient;
import com.github.lianjiatech.retrofit.spring.boot.util.AppContextUtils;
-
import lombok.SneakyThrows;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.core.annotation.AnnotatedElementUtils;
import retrofit2.Invocation;
+import java.io.IOException;
+
/**
* @author 陈添明
*/
@@ -31,12 +26,12 @@ public class ErrorDecoderInterceptor implements Interceptor, ApplicationContextA
@SneakyThrows
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
- Method method = RetrofitUtils.getMethodFormRequest(request);
- if (method == null) {
+ Invocation invocation = request.tag(Invocation.class);
+ if (invocation == null) {
return chain.proceed(request);
}
RetrofitClient retrofitClient =
- AnnotatedElementUtils.findMergedAnnotation(method.getDeclaringClass(), RetrofitClient.class);
+ AnnotatedElementUtils.findMergedAnnotation(invocation.service(), RetrofitClient.class);
ErrorDecoder errorDecoder =
AppContextUtils.getBeanOrNew(applicationContext, retrofitClient.errorDecoder());
boolean decoded = false;
diff --git a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/interceptor/ServiceChooseInterceptor.java b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/interceptor/ServiceChooseInterceptor.java
index 1995e87..6738579 100644
--- a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/interceptor/ServiceChooseInterceptor.java
+++ b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/interceptor/ServiceChooseInterceptor.java
@@ -1,23 +1,18 @@
package com.github.lianjiatech.retrofit.spring.boot.interceptor;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.util.Objects;
-
-import com.github.lianjiatech.retrofit.spring.boot.util.RetrofitUtils;
-import org.springframework.core.annotation.AnnotatedElementUtils;
-import org.springframework.util.StringUtils;
-
import com.github.lianjiatech.retrofit.spring.boot.core.RetrofitClient;
import com.github.lianjiatech.retrofit.spring.boot.core.ServiceInstanceChooser;
-
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
+import org.springframework.core.annotation.AnnotatedElementUtils;
+import org.springframework.util.StringUtils;
import retrofit2.Invocation;
+import java.io.IOException;
+import java.net.URI;
+
/**
* @author 陈添明
*/
@@ -32,13 +27,12 @@ public ServiceChooseInterceptor(ServiceInstanceChooser serviceDiscovery) {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
- Method method = RetrofitUtils.getMethodFormRequest(request);
- if (method == null) {
+ Invocation invocation = request.tag(Invocation.class);
+ if (invocation == null) {
return chain.proceed(request);
}
- Class> declaringClass = method.getDeclaringClass();
RetrofitClient retrofitClient =
- AnnotatedElementUtils.findMergedAnnotation(declaringClass, RetrofitClient.class);
+ AnnotatedElementUtils.findMergedAnnotation(invocation.service(), RetrofitClient.class);
String baseUrl = retrofitClient.baseUrl();
if (StringUtils.hasText(baseUrl)) {
return chain.proceed(request);
diff --git a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/log/LoggingInterceptor.java b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/log/LoggingInterceptor.java
index 5947f31..a77e948 100644
--- a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/log/LoggingInterceptor.java
+++ b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/log/LoggingInterceptor.java
@@ -1,18 +1,15 @@
package com.github.lianjiatech.retrofit.spring.boot.log;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.util.Objects;
-
import com.github.lianjiatech.retrofit.spring.boot.util.AnnotationExtendUtils;
-
-import com.github.lianjiatech.retrofit.spring.boot.util.RetrofitUtils;
import lombok.extern.slf4j.Slf4j;
import okhttp3.Interceptor;
+import okhttp3.Request;
import okhttp3.Response;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Invocation;
+import java.io.IOException;
+
/**
* @author 陈添明
* @since 2022/4/30 8:21 下午
@@ -41,17 +38,18 @@ public Response intercept(Chain chain) throws IOException {
.setLevel(HttpLoggingInterceptor.Level.valueOf(logStrategy.name()));
Response response = httpLoggingInterceptor.intercept(chain);
if (aggregate) {
- ((BufferingLogger)logger).flush();
+ ((BufferingLogger) logger).flush();
}
return response;
}
protected Logging findLogging(Chain chain) {
- Method method = RetrofitUtils.getMethodFormRequest(chain.request());
- if (method == null) {
+ Request request = chain.request();
+ Invocation invocation = request.tag(Invocation.class);
+ if (invocation == null) {
return null;
}
- return AnnotationExtendUtils.findMergedAnnotation(method, method.getDeclaringClass(), Logging.class);
+ return AnnotationExtendUtils.findMergedAnnotation(invocation.method(), invocation.service(), Logging.class);
}
protected boolean needLog(Logging logging) {
diff --git a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/retry/RetryInterceptor.java b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/retry/RetryInterceptor.java
index a6730d4..086f962 100644
--- a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/retry/RetryInterceptor.java
+++ b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/retry/RetryInterceptor.java
@@ -1,22 +1,18 @@
package com.github.lianjiatech.retrofit.spring.boot.retry;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
import com.github.lianjiatech.retrofit.spring.boot.exception.RetryFailedException;
import com.github.lianjiatech.retrofit.spring.boot.util.AnnotationExtendUtils;
-
-import com.github.lianjiatech.retrofit.spring.boot.util.RetrofitUtils;
import lombok.extern.slf4j.Slf4j;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import retrofit2.Invocation;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.stream.Collectors;
+
/**
* @author 陈添明
*/
@@ -32,12 +28,12 @@ public RetryInterceptor(GlobalRetryProperty globalRetryProperty) {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
- Method method = RetrofitUtils.getMethodFormRequest(request);
- if (method == null) {
+ Invocation invocation = request.tag(Invocation.class);
+ if (invocation == null) {
return chain.proceed(request);
}
// 获取重试配置
- Retry retry = AnnotationExtendUtils.findMergedAnnotation(method, method.getDeclaringClass(), Retry.class);
+ Retry retry = AnnotationExtendUtils.findMergedAnnotation(invocation.method(), invocation.service(), Retry.class);
if (!needRetry(retry)) {
return chain.proceed(request);
}
diff --git a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/util/RetrofitUtils.java b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/util/RetrofitUtils.java
index ebe951a..5849633 100644
--- a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/util/RetrofitUtils.java
+++ b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/util/RetrofitUtils.java
@@ -1,17 +1,7 @@
package com.github.lianjiatech.retrofit.spring.boot.util;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-
-import okhttp3.Request;
-import org.springframework.core.env.Environment;
-import org.springframework.util.StringUtils;
-
import com.github.lianjiatech.retrofit.spring.boot.core.RetrofitClient;
import com.github.lianjiatech.retrofit.spring.boot.exception.ReadResponseBodyException;
-
import lombok.experimental.UtilityClass;
import okhttp3.Headers;
import okhttp3.MediaType;
@@ -20,7 +10,11 @@
import okio.Buffer;
import okio.BufferedSource;
import okio.GzipSource;
-import retrofit2.Invocation;
+import org.springframework.core.env.Environment;
+import org.springframework.util.StringUtils;
+
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
/**
* @author 陈添明
@@ -107,15 +101,4 @@ public static String convertBaseUrl(RetrofitClient retrofitClient, String baseUr
}
return baseUrl;
}
-
- public Method getMethodFormRequest(Request request) {
- if (request == null) {
- return null;
- }
- Invocation invocation = request.tag(Invocation.class);
- if (invocation == null) {
- return null;
- }
- return invocation.method();
- }
}
diff --git a/src/test/java/com/github/lianjiatech/retrofit/spring/boot/test/integration/inherit/Sub.java b/src/test/java/com/github/lianjiatech/retrofit/spring/boot/test/integration/inherit/Sub.java
new file mode 100644
index 0000000..cb9899d
--- /dev/null
+++ b/src/test/java/com/github/lianjiatech/retrofit/spring/boot/test/integration/inherit/Sub.java
@@ -0,0 +1,15 @@
+package com.github.lianjiatech.retrofit.spring.boot.test.integration.inherit;
+
+import com.github.lianjiatech.retrofit.spring.boot.core.RetrofitClient;
+import retrofit2.http.GET;
+import retrofit2.http.Query;
+
+@RetrofitClient(baseUrl = "${test.baseUrl}")
+public interface Sub extends Super {
+
+ /**
+ * 根据id查询用户姓名
+ */
+ @GET("getNameSub")
+ String getNameSub(@Query("id") Long id);
+}
diff --git a/src/test/java/com/github/lianjiatech/retrofit/spring/boot/test/integration/inherit/SubTest.java b/src/test/java/com/github/lianjiatech/retrofit/spring/boot/test/integration/inherit/SubTest.java
new file mode 100644
index 0000000..51a0ede
--- /dev/null
+++ b/src/test/java/com/github/lianjiatech/retrofit/spring/boot/test/integration/inherit/SubTest.java
@@ -0,0 +1,33 @@
+package com.github.lianjiatech.retrofit.spring.boot.test.integration.inherit;
+
+import com.github.lianjiatech.retrofit.spring.boot.test.integration.MockWebServerTest;
+import com.github.lianjiatech.retrofit.spring.boot.test.integration.RetrofitBootApplication;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import static org.junit.Assert.assertEquals;
+
+@SpringBootTest(classes = {RetrofitBootApplication.class})
+@RunWith(SpringRunner.class)
+public class SubTest extends MockWebServerTest {
+
+ @Autowired
+ private Sub sub;
+
+ @Test
+ public void getNameSub() {
+ mockServerReturnString(MIKE);
+ String name = sub.getNameSub(Long100);
+ assertEquals(MIKE, name);
+ }
+
+ @Test
+ public void getNameSuper() {
+ mockServerReturnString(MIKE);
+ String name = sub.getNameSuper(Long100);
+ assertEquals(MIKE, name);
+ }
+}
diff --git a/src/test/java/com/github/lianjiatech/retrofit/spring/boot/test/integration/inherit/Super.java b/src/test/java/com/github/lianjiatech/retrofit/spring/boot/test/integration/inherit/Super.java
new file mode 100644
index 0000000..db9f100
--- /dev/null
+++ b/src/test/java/com/github/lianjiatech/retrofit/spring/boot/test/integration/inherit/Super.java
@@ -0,0 +1,13 @@
+package com.github.lianjiatech.retrofit.spring.boot.test.integration.inherit;
+
+import retrofit2.http.GET;
+import retrofit2.http.Query;
+
+public interface Super {
+
+ /**
+ * 根据id查询用户姓名
+ */
+ @GET("getNameSuper")
+ String getNameSuper(@Query("id") Long id);
+}