enable feign.autoconfiguration.jackson.enabled by default (#476)

This commit is contained in:
Nikita Konev
2022-10-12 18:24:28 +03:00
committed by GitHub
parent 28345b2ad9
commit e1a9b775ad
4 changed files with 9 additions and 6 deletions

View File

@@ -783,13 +783,16 @@ ObjectProvider<TestFeignClient> testFeignClient;
=== Spring Data Support
You may consider enabling Jackson Modules for the support `org.springframework.data.domain.Page` and `org.springframework.data.domain.Sort` decoding.
If Jackson Databind and Spring Data Commons are on the classpath, converters for `org.springframework.data.domain.Page` and `org.springframework.data.domain.Sort` will be added automatically.
To disable this behaviour set
[source,java]
----
spring.cloud.openfeign.autoconfiguration.jackson.enabled=true
spring.cloud.openfeign.autoconfiguration.jackson.enabled=false
----
See `org.springframework.cloud.openfeign.FeignAutoConfiguration.FeignJacksonConfiguration` for details.
=== Spring `@RefreshScope` Support
If Feign client refresh is enabled, each feign client is created with `feign.Request.Options` as a refresh-scoped bean. This means properties such as `connectTimeout` and `readTimeout` can be refreshed against any Feign client instance through `POST /actuator/refresh`.

View File

@@ -120,7 +120,8 @@ public class FeignAutoConfiguration {
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ Module.class, Page.class, Sort.class })
@ConditionalOnProperty(value = "spring.cloud.openfeign.autoconfiguration.jackson.enabled", havingValue = "true")
@ConditionalOnProperty(value = "spring.cloud.openfeign.autoconfiguration.jackson.enabled", havingValue = "true",
matchIfMissing = true)
protected static class FeignJacksonConfiguration {
@Bean

View File

@@ -6,7 +6,7 @@
"name": "spring.cloud.openfeign.autoconfiguration.jackson.enabled",
"type": "java.lang.Boolean",
"description": "If true, PageJacksonModule and SortJacksonModule bean will be provided for Jackson page decoding.",
"defaultValue": "false"
"defaultValue": "true"
},
{
"name": "spring.cloud.openfeign.circuitbreaker.enabled",

View File

@@ -55,8 +55,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
* @author Hyeonmin Park
*/
@SpringBootTest(classes = FeignPageableEncodingTests.Application.class, webEnvironment = RANDOM_PORT,
value = { "spring.cloud.openfeign.compression.request.enabled=true",
"spring.cloud.openfeign.autoconfiguration.jackson.enabled=true" })
value = { "spring.cloud.openfeign.compression.request.enabled=true" })
class FeignPageableEncodingTests {
@Autowired