Feign makes writing java http clients easier
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 c39376fde3 Preparing for next development version 1 year ago
..
src Update all license headers to 2023 2 years ago
README.md Rework the Jackson module as a Jackson Jr alternative (#1409) 3 years ago
pom.xml Preparing for next development version 1 year 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");