Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Outline

Jackson 3 Codec

This module adds support for encoding and decoding JSON via Jackson 3.

Note: Jackson 3 requires Java 17 or higher.

Add Jackson3Codec to your Feign.Builder like so:

GitHub github = Feign.builder()
                     .codec(new Jackson3Codec())
                     .target(GitHub.class, "https://api.github.com");

If you want to customize the JsonMapper that is used, provide it to the Jackson3Codec:

JsonMapper mapper = JsonMapper.builder()
        .changeDefaultPropertyInclusion(incl -> incl.withValueInclusion(JsonInclude.Include.NON_NULL))
        .enable(SerializationFeature.INDENT_OUTPUT)
        .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
        .build();

GitHub github = Feign.builder()
                     .codec(new Jackson3Codec(mapper))
                     .target(GitHub.class, "https://api.github.com");

You can also configure the encoder and decoder separately:

GitHub github = Feign.builder()
                     .encoder(new Jackson3Encoder())
                     .decoder(new Jackson3Decoder())
                     .target(GitHub.class, "https://api.github.com");

Migration from Jackson 2 to Jackson 3

The main differences are:

  • Package changes: com.fasterxml.jacksontools.jackson (except for com.fasterxml.jackson.annotation)
  • GroupId changes: com.fasterxml.jackson.coretools.jackson.core
  • ObjectMapper is immutable and must be configured via JsonMapper.builder()
  • Java 17 minimum requirement
Morty Proxy This is a proxified and sanitized view of the page, visit original site.