Skip to content

Programmatic custom context inside FeignContext #594

@Sam-Kruglov

Description

@Sam-Kruglov

I can do @FeignClient(contextId = "fooClient", name = "stores", configuration = FooConfiguration.class).
But if I create the clients manually via FeignClientBuilder (uses ApplicationContext) then I can't see a way to override stuff from FeignClientsConfiguration like an encoder.

I see that there is a FeignContext class, and the concept of NamedContextFactory but there is no way to use it, as I don't have access to the getContext method to register my stuff, nor to implement my own FeignClientSpecification.
Since it's there already, I don't think it's a feature request.

My concrete use case is that I have several vendor integrations at the same time, and each vendor has several feign clients with different credentials. One vendor has a custom encoder, and each has a custom decoder to throw custom exceptions. I create each client at runtime by using a FeignClientBuilder. It would've been a little cleaner if I extracted these customizations into FeignClientSpecification for each vendor rather than having them in code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions