Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d111204007 | ||
|
|
b4c9567de5 | ||
|
|
8fdb488697 | ||
|
|
7e01355317 | ||
|
|
fc459044b5 |
+1
-1
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-openfeign</artifactId>
|
||||
<version>3.0.7</version>
|
||||
<version>3.0.8</version>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-openfeign-docs</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -197,7 +197,7 @@ feign:
|
||||
|
||||
Default configurations can be specified in the `@EnableFeignClients` attribute `defaultConfiguration` in a similar manner as described above. The difference is that this configuration will apply to _all_ feign clients.
|
||||
|
||||
If you prefer using configuration properties to configured all `@FeignClient`, you can create configuration properties with `default` feign name.
|
||||
If you prefer using configuration properties to configure all `@FeignClient`, you can create configuration properties with `default` feign name.
|
||||
|
||||
You can use `feign.client.config.feignName.defaultQueryParameters` and `feign.client.config.feignName.defaultRequestHeaders` to specify query parameters and headers that will be sent with every request of the client named `feignName`.
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>spring-cloud-openfeign</artifactId>
|
||||
<version>3.0.7</version>
|
||||
<version>3.0.8</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Spring Cloud OpenFeign</name>
|
||||
<description>Spring Cloud OpenFeign</description>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-openfeign</artifactId>
|
||||
<version>3.0.7</version>
|
||||
<version>3.0.8</version>
|
||||
<relativePath>..</relativePath> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<artifactId>spring-cloud-openfeign-core</artifactId>
|
||||
|
||||
+6
-4
@@ -22,6 +22,7 @@ import java.util.function.Function;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.Version;
|
||||
import com.fasterxml.jackson.databind.Module;
|
||||
@@ -59,6 +60,7 @@ public class PageJacksonModule extends Module {
|
||||
}
|
||||
|
||||
@JsonDeserialize(as = SimplePageImpl.class)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
private interface PageMixIn {
|
||||
|
||||
}
|
||||
@@ -86,7 +88,7 @@ public class PageJacksonModule extends Module {
|
||||
}
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JsonProperty
|
||||
@Override
|
||||
public int getTotalPages() {
|
||||
return delegate.getTotalPages();
|
||||
@@ -110,7 +112,7 @@ public class PageJacksonModule extends Module {
|
||||
return delegate.getSize();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JsonProperty
|
||||
@Override
|
||||
public int getNumberOfElements() {
|
||||
return delegate.getNumberOfElements();
|
||||
@@ -134,13 +136,13 @@ public class PageJacksonModule extends Module {
|
||||
return delegate.getSort();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JsonProperty
|
||||
@Override
|
||||
public boolean isFirst() {
|
||||
return delegate.isFirst();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@JsonProperty
|
||||
@Override
|
||||
public boolean isLast() {
|
||||
return delegate.isLast();
|
||||
|
||||
+57
-4
@@ -82,10 +82,10 @@ public class PageJacksonModuleTests {
|
||||
@Test
|
||||
public void serializeAndDeserializeFilledMultiple() throws JsonProcessingException {
|
||||
// Given
|
||||
ArrayList<Object> strings0 = new ArrayList<>();
|
||||
strings0.add("first element");
|
||||
strings0.add("second element");
|
||||
PageImpl<Object> objects = new PageImpl<>(strings0, PageRequest.of(6, 2), 100);
|
||||
ArrayList<Object> pageElements = new ArrayList<>();
|
||||
pageElements.add("first element");
|
||||
pageElements.add("second element");
|
||||
PageImpl<Object> objects = new PageImpl<>(pageElements, PageRequest.of(6, 2), 100);
|
||||
assertThat(objects.getContent()).hasSize(2);
|
||||
assertThat(objects.getPageable().getPageSize()).isEqualTo(2);
|
||||
|
||||
@@ -102,4 +102,57 @@ public class PageJacksonModuleTests {
|
||||
assertThat(result.getPageable().getPageNumber()).isEqualTo(6);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void serializeAndDeserializeEmptyCascade() throws JsonProcessingException {
|
||||
// Given
|
||||
PageImpl<Object> objects = new PageImpl<>(new ArrayList<>());
|
||||
String pageJson = objectMapper.writeValueAsString(objects);
|
||||
// When
|
||||
Page<?> result = objectMapper.readValue(pageJson, Page.class);
|
||||
// Then
|
||||
assertThat(result).isNotNull();
|
||||
assertThat(result.getTotalElements()).isEqualTo(0);
|
||||
assertThat(result.getContent()).hasSize(0);
|
||||
|
||||
String cascadedPageJson = objectMapper.writeValueAsString(result);
|
||||
Page<?> cascadedResult = objectMapper.readValue(cascadedPageJson, Page.class);
|
||||
assertThat(cascadedResult).isNotNull();
|
||||
assertThat(cascadedResult.getTotalElements()).isEqualTo(0);
|
||||
assertThat(cascadedResult.getContent()).hasSize(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void serializeAndDeserializeFilledMultipleCascade() throws JsonProcessingException {
|
||||
// Given
|
||||
ArrayList<Object> pageElements = new ArrayList<>();
|
||||
pageElements.add("first element in cascaded serialization");
|
||||
pageElements.add("second element in cascaded serialization");
|
||||
PageImpl<Object> objects = new PageImpl<>(pageElements, PageRequest.of(6, 2), 100);
|
||||
assertThat(objects.getContent()).hasSize(2);
|
||||
assertThat(objects.getPageable().getPageSize()).isEqualTo(2);
|
||||
|
||||
String pageJson = objectMapper.writeValueAsString(objects);
|
||||
// When
|
||||
Page<?> result = objectMapper.readValue(pageJson, Page.class);
|
||||
// Then
|
||||
assertThat(result).isNotNull();
|
||||
assertThat(result.getTotalElements()).isEqualTo(100);
|
||||
assertThat(result.getContent()).hasSize(2);
|
||||
assertThat(result.getContent().get(0)).isEqualTo("first element in cascaded serialization");
|
||||
assertThat(result.getContent().get(1)).isEqualTo("second element in cascaded serialization");
|
||||
assertThat(result.getPageable().getPageSize()).isEqualTo(2);
|
||||
assertThat(result.getPageable().getPageNumber()).isEqualTo(6);
|
||||
|
||||
String cascadedPageJson = objectMapper.writeValueAsString(result);
|
||||
Page<?> cascadedResult = objectMapper.readValue(cascadedPageJson, Page.class);
|
||||
// Then
|
||||
assertThat(cascadedResult).isNotNull();
|
||||
assertThat(cascadedResult.getTotalElements()).isEqualTo(100);
|
||||
assertThat(cascadedResult.getContent()).hasSize(2);
|
||||
assertThat(cascadedResult.getContent().get(0)).isEqualTo("first element in cascaded serialization");
|
||||
assertThat(cascadedResult.getContent().get(1)).isEqualTo("second element in cascaded serialization");
|
||||
assertThat(cascadedResult.getPageable().getPageSize()).isEqualTo(2);
|
||||
assertThat(cascadedResult.getPageable().getPageNumber()).isEqualTo(6);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-openfeign-dependencies</artifactId>
|
||||
<version>3.0.7</version>
|
||||
<version>3.0.8</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>spring-cloud-openfeign-dependencies</name>
|
||||
<description>Spring Cloud OpenFeign Dependencies</description>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-openfeign</artifactId>
|
||||
<version>3.0.7</version>
|
||||
<version>3.0.8</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user