Describe the bug
I've tried to reproduce the doc tutorial using a kotlin environment https://quarkus.io/guides/rest-client. It won't instanciate the rest client:
org.junit.jupiter.api.extension.TestInstantiationException: TestInstanceFactory [io.quarkus.test.junit.QuarkusTestExtension] failed to instantiate test class [org.acme.ExampleResourceTest]: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.acme.CountriesService and qualifiers [@Default]
- java member: org.acme.ExampleResource#countriesService
- declared on CLASS bean [types=[org.acme.ExampleResource], qualifiers=[@Default, @Any], target=org.acme.ExampleResource]
at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:850)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:220)
at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:106)
at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:251)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:941)
at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.acme.CountriesService and qualifiers [@Default]
- java member: org.acme.ExampleResource#countriesService
- declared on CLASS bean [types=[org.acme.ExampleResource], qualifiers=[@Default, @Any], target=org.acme.ExampleResource]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:472)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:404)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:212)
... 14 more
Expected behavior
It should instanciate it and work
Actual behavior
We get an exception
To Reproduce
Steps to reproduce the behavior:
package org.acme
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient
import javax.ws.rs.GET
import javax.ws.rs.Path
import javax.ws.rs.Produces
@Path("/v2")
@RegisterRestClient(baseUri = "https://andy/")
interface CountriesService {
@GET
@Path("/get")
@Produces("application/json")
fun get(): Set<String>
}
...
@Path("/hello")
class ExampleResource {
@Inject
@RestClient
lateinit var countriesService: CountriesService
...
@ia3andy maybe we can raise this issue on the MP RestClient side ? As I understand it, adding an @Target on the @RestClient annotation may help Kotlin.
@loicmathieu yeah, that would be great. I don't see why a developer should have to do something special to make it work.
I'm reopening this one. Let's close it when we upgrade MP Rest Client.
This is fixed AFAIK
Most helpful comment
Raised https://github.com/eclipse/microprofile-rest-client/issues/232