Merge branch 'master' of github.com:spring-cloud/spring-cloud-openfeign
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<properties>
|
||||
<docs.main>spring-cloud-openfeign</docs.main>
|
||||
<main.basedir>${basedir}/..</main.basedir>
|
||||
<docs.whitelisted.branches>2.0.x</docs.whitelisted.branches>
|
||||
<docs.whitelisted.branches>2.0.x,2.1.x</docs.whitelisted.branches>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
0
docs/src/main/asciidoc/sagan-boot.adoc
Normal file
0
docs/src/main/asciidoc/sagan-boot.adoc
Normal file
26
docs/src/main/asciidoc/sagan-index.adoc
Normal file
26
docs/src/main/asciidoc/sagan-index.adoc
Normal file
@@ -0,0 +1,26 @@
|
||||
This project provides https://github.com/OpenFeign/feign[OpenFeign] integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment and other Spring programming model idioms.
|
||||
|
||||
## Features
|
||||
|
||||
* Declarative REST Client: Feign creates a dynamic implementation of an interface decorated with JAX-RS or Spring MVC annotations
|
||||
|
||||
## Getting Started
|
||||
|
||||
|
||||
```java
|
||||
@SpringBootApplication
|
||||
@EnableFeignClients
|
||||
public class WebApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(WebApplication.class, args);
|
||||
}
|
||||
|
||||
@FeignClient("name")
|
||||
static interface NameService {
|
||||
@RequestMapping("/")
|
||||
public String getName();
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
@@ -56,7 +56,8 @@ public final class FeignUtils {
|
||||
|
||||
static Collection<String> addTemplateParameter(Collection<String> possiblyNull,
|
||||
String paramName) {
|
||||
Collection<String> params = ofNullable(possiblyNull).orElse(new ArrayList<>());
|
||||
Collection<String> params = ofNullable(possiblyNull).map(ArrayList::new)
|
||||
.orElse(new ArrayList<>());
|
||||
params.add(String.format("{%s}", paramName));
|
||||
return params;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class SpringDecoder implements Decoder {
|
||||
|
||||
return extractor.extractData(new FeignResponseAdapter(response));
|
||||
}
|
||||
throw new DecodeException(
|
||||
throw new DecodeException(response.status(),
|
||||
"type is not an instance of Class or ParameterizedType: " + type);
|
||||
}
|
||||
|
||||
|
||||
@@ -523,6 +523,18 @@ public class SpringMvcContractTests {
|
||||
this.contract.parseAndValidateMetadata(method.getDeclaringClass(), method);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddingTemplatedParameterWithTheSameKey()
|
||||
throws NoSuchMethodException {
|
||||
Method method = TestTemplate_Advanced.class.getDeclaredMethod(
|
||||
"testAddingTemplatedParamForExistingKey", String.class);
|
||||
MethodMetadata data = contract
|
||||
.parseAndValidateMetadata(method.getDeclaringClass(), method);
|
||||
|
||||
assertThat(data.template().headers().get("Accept")).contains("application/json",
|
||||
"{Accept}");
|
||||
}
|
||||
|
||||
public interface TestTemplate_Simple {
|
||||
|
||||
@RequestMapping(value = "/test/{id}", method = RequestMethod.GET,
|
||||
@@ -653,6 +665,10 @@ public class SpringMvcContractTests {
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
TestObject getTest();
|
||||
|
||||
@GetMapping(produces = "application/json")
|
||||
String testAddingTemplatedParamForExistingKey(
|
||||
@RequestHeader("Accept") String accept);
|
||||
|
||||
}
|
||||
|
||||
public interface TestTemplate_DateTimeFormatParameter {
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
<name>spring-cloud-openfeign-dependencies</name>
|
||||
<description>Spring Cloud OpenFeign Dependencies</description>
|
||||
<properties>
|
||||
<feign.version>10.1.0</feign.version>
|
||||
<feign-form.version>3.5.0</feign-form.version>
|
||||
<feign.version>10.2.3</feign.version>
|
||||
<feign-form.version>3.8.0</feign-form.version>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
Reference in New Issue
Block a user