-
Hi, I am trying to setup a unit test for a service which has dependency on a certain RequestScoped REST client, is it possible to use InjectMock to setup the REST client mock? From what i have seen in this blogpost https://quarkus.io/blog/mocking/ and in documentation https://quarkus.io/guides/rest-client#mocking-with-injectmock this is not possible expect when using the Registered Client default scope or it being ApplicationScoped. |
Beta Was this translation helpful? Give feedback.
Answered by
geoand
Dec 9, 2024
Replies: 1 comment 5 replies
-
/cc @cescoffier (rest-client), @geoand (rest-client) |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thread-safery is orthogonal to whether the client is request scoped or not. And in all reality
@RequestScoped
is tied to the current request being served, so it something that needs to be active (for example automatically by Quarkus when an HTTP request is being served or manually by starting the scope) before any such bean is used.Actually, I would very much recommend not using request scoped for the REST Client as you are going to be creating a very large overhead for each request.