Skip to content

Should the documentation have an example for how to use multiple decoders? #1249

@sshevlyagin

Description

@sshevlyagin

In my implementation I need to use the default decoder for byte[] and GsonDecoder to map to objects and I'm doing the following in Java 11:

@Bean
    public Decoder decoder() {
        Decoder decoder = (response, type) -> {
            if (type.getTypeName().equals("java.lang.String") ||
                    type.getTypeName().equals("byte[]")
            ) {
                return new Decoder.Default().decode(response, type);
            } else {
                return new GsonDecoder().decode(response, type);
            }
        };
        return new ResponseEntityDecoder(decoder);
    }

Is this worth having an example in the documentation? I was inspired by this discussion spring-cloud/spring-cloud-netflix#2246

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationIssues that require updates to our documentationfeedback providedFeedback has been provided to the author

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions