Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rest Client: Support config properties in @ClientHeaderParam #19828

Closed
michalszynkiewicz opened this issue Sep 1, 2021 · 3 comments · Fixed by #19830
Closed

Rest Client: Support config properties in @ClientHeaderParam #19828

michalszynkiewicz opened this issue Sep 1, 2021 · 3 comments · Fixed by #19830
Labels
kind/enhancement New feature or request

Comments

@michalszynkiewicz
Copy link
Member

Description

Support passing header values from properties directly with sth like

@ClientHeaderParam(name="my-header", value="${my-property}")

Implementation ideas

No response

@michalszynkiewicz michalszynkiewicz added the kind/enhancement New feature or request label Sep 1, 2021
@michalszynkiewicz michalszynkiewicz changed the title Support config properties in @ClientHeaderParam Rest Client: Support config properties in @ClientHeaderParam Sep 1, 2021
@michalszynkiewicz
Copy link
Member Author

Note: This change will be implemented only in Rest Client Reactive

@cescoffier
Copy link
Member

Maybe a bit of rationale.
When integrating remote HTTP services, you often need to pass headers, typically to handle authentication (you pass a token or an API key). The rest client provides header support, but the value of the headers cannot come from the configuration. You need to target a static method. As these static methods cannot use @ConfigProperty, you end up using a static accessor for the configuration. Far from 1. being easy, 2. being discoverable.

The extension to customize the header can work but introduce another bean implementing a convoluted interface (receive 2 multimaps and returns one).

The idea here is to provide an easy way to access configured properties, without having to use any of these approaches. Something plain simple.

One question is where the property must be resolved from the config-key of the client or from the root of the configuration.

@michalszynkiewicz
Copy link
Member Author

fixed in the linked PR.
ATM we use root-based config keys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants