You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Marvin Froeder
bfc2f37518
|
2 years ago | |
---|---|---|
.. | ||
src | 2 years ago | |
README.md | 4 years ago | |
pom.xml | 2 years ago |
README.md
Jackson Jr Codec
This module adds support for encoding and decoding JSON via Jackson Jr. This is a significantly smaller and faster version of Jackson, which may be of benefit in smaller runtime containers.
Add JacksonJrEncoder
and/or JacksonJrDecoder
to your Feign.Builder
like so:
GitHub github = Feign.builder()
.encoder(new JacksonJrEncoder())
.decoder(new JacksonJrDecoder())
.target(GitHub.class, "https://api.github.com");
If you want to customize the JSON
object that is used, provide it to the JacksonJrEncoder
and JacksonJrDecoder
:
JSON json = Json.builder()
.register(JacksonAnnotationExtension.builder()
.withVisibility(JsonAutoDetect.Value.defaultVisibility())
.build())
.build();
GitHub github = Feign.builder()
.encoder(new JacksonJrEncoder(json))
.decoder(new JacksonJrDecoder(json))
.target(GitHub.class, "https://api.github.com");
Customisation is also possible by passing JacksonJrExtension
objects
into the constructor of the JacksonJrEncoder
or JacksonJrDecoder
:
List<JacksonJrExtension> extensions = singletonList(JacksonAnnotationExtension.builder()
.withVisibility(JsonAutoDetect.Value.defaultVisibility())
.build());
GitHub github = Feign.builder()
.encoder(new JacksonJrEncoder(extensions))
.decoder(new JacksonJrDecoder(extensions))
.target(GitHub.class, "https://api.github.com");