quarkus: Injecting into custom ClientRequestFilter does not work with Reactive RestClient
Describe the bug
Reported by Simone DiCola.
For example, injecting a RequestScoped
Tokens
shipped with quarkus-oidc-client
into a custom filter:
@Provider
@Priority(Priorities.AUTHENTICATION)
public class OidcClientRequestCustomFilter implements ClientRequestFilter {
@Inject
Tokens tokens;
@Override
public void filter(ClientRequestContext requestContext) throws IOException {
requestContext.getHeaders().add(HttpHeaders.AUTHORIZATION, "Bearer " + tokens.getAccessToken());
}
}
works with quarkus-rest-client
but it is null
with quarkus-rest-client-reactive
.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (16 by maintainers)
Commits related to this issue
- Make providers registered with @RegisterProvider CDI beans in reactive rest client Fixes: #16540 — committed to geoand/quarkus by geoand 3 years ago
- Make providers registered with @RegisterProvider CDI beans in reactive rest client Fixes: #16540 — committed to geoand/quarkus by geoand 3 years ago
- Make providers registered with @RegisterProvider CDI beans in reactive rest client Fixes: #16540 — committed to geoand/quarkus by geoand 3 years ago
- Make providers registered with @RegisterProvider CDI beans in reactive rest client Fixes: #16540 — committed to geoand/quarkus by geoand 3 years ago
- Merge pull request #16673 from geoand/#16540 Make providers registered with @RegisterProvider CDI beans in reactive rest client — committed to quarkusio/quarkus by geoand 3 years ago
Actually the test passes now - it is just that the reactive client is a bit sensitive to the lack of
@Produces("text/plain")
- probably because it assumesapplication/json
by default… So all is good there - if you’d like please close this issue - unless you’d like to track a possible@RegisterProvider(MyProvider.class)
+ CDI enhancement here…Cheers
Thanks @sberyozkin. If you come up with a reproducer of the problem, I’d love to see it 😃
@geoand, Np at all, cool, great you are already aware of where the problem is 😃