Rest Client extension seems to have problem with kotlin
See original GitHub issueDescribe 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>
}
- Inject it:
...
@Path("/hello")
class ExampleResource {
@Inject
@RestClient
lateinit var countriesService: CountriesService
...
- run the test
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Error to inject some dependency with kotlin + quarkus
This problem results as a combination of how Kotlin handles annotations and the lack of the a @Target on the @RestClient annotation ...
Read more >Using Kotlin - Quarkus
The Quarkus Kotlin extension already declares a dependency on some base Kotlin libraries like kotlin-stdlib-jdk8 and kotlin-reflect . The Kotlin version of ...
Read more >Calling Java from Kotlin
In this section, we describe some details about calling Java code from Kotlin. Pretty much all Java code can be used without any...
Read more >Using the REST Client within PhpStorm and WebStorm
When building REST-based web APIs, it's worth having a tool available to invoke them over HTTP. The current versions of WebStorm 6, ...
Read more >Known issues with Android Studio and Android Gradle Plugin
To fix the issue for the current project, click Run > Edit Configurations and change the default JUnit configuration to only include the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Raised https://github.com/eclipse/microprofile-rest-client/issues/232
This is fixed AFAIK