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

Microprofile rest client - Can't inject config/beans to providers #101

Closed
snowdrop-bot opened this issue Jan 14, 2020 · 0 comments
Closed

Comments

@snowdrop-bot
Copy link

Describe the bug
Any provider added to rest client via @Provider annotation is unable to inject config bean or any other application scoped bean.

@RegisterRestClient
@RegisterProvider(RequestFilter.class)
public interface EchoService {....}

And example the provider impl:

public class RequestFilter implements ClientRequestFilter {
  @Inject
  AppConfig config;  //is always null

  @Inject
  SomeBean bean; //is always null

  @Override
  public void filter(ClientRequestContext requestContext) throws IOException {...}

Expected behavior
Config or application scope bean injected and not null

Actual behavior
Any bean injected via @Inject is alway null (no errors in logs during argumentation nor during runtime.

To Reproduce
Steps to reproduce the behavior:

  1. Use reproducer: https://github.com/marcinczeczko/quarkus-rest-providers-reproducer
  2. mvn compile quarkus:dev
  3. curl http://localhost:8080/echo
  4. Check the logs - the injected config & app bean shows null reference

Configuration

  • See reproducer

Screenshots
N/A

Environment (please complete the following information):

  • Output of uname -a or ver: 18.7.0 Darwin Kernel Version 18.7.0: Sat Oct 12 00:02:19 PDT 2019; root:xnu-4903.278.12~1/RELEASE_X86_64 x86_64
  • Output of java -version:
java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)
  • GraalVM version (if different from Java): Didn't check on graalvm
  • Quarkus version or git rev: 1.0.0.Final

Additional context

I found out there is a closed issue for similar problem, but looks like the fix doesn't work, see: quarkusio#2773


$upstream:5752$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant