无法在Quarkus kotlin应用中注入REST客户端接口
我尝试为我的应用程序添加quarkus rest客户端示例,这是一个使用quarkus构建的简单rest API java版本运行良好 当我添加另一个Kotlin来测试Quarkus中的Kotlin和Gradle支持时,它失败了,REST客户端接口不能作为CDIBean注入 postcontroller是Jaxrs资源,用于公开合并了原始两个API的聚合API无法在Quarkus kotlin应用中注入REST客户端接口,kotlin,resteasy,jsonb,quarkus,microprofile,Kotlin,Resteasy,Jsonb,Quarkus,Microprofile,我尝试为我的应用程序添加quarkus rest客户端示例,这是一个使用quarkus构建的简单rest API java版本运行良好 当我添加另一个Kotlin来测试Quarkus中的Kotlin和Gradle支持时,它失败了,REST客户端接口不能作为CDIBean注入 postcontroller是Jaxrs资源,用于公开合并了原始两个API的聚合API @Path("/api") @RequestScoped class PostController(@Inject @RestClien
@Path("/api")
@RequestScoped
class PostController(@Inject @RestClient val client: PostResourceClient) {
// @Inject
// @RestClient
// lateinit var client: PostServiceClient
@GET
@Produces(MediaType.APPLICATION_JSON)
fun getPosts(@QueryParam("q")
q: String,
@QueryParam("offset")
@DefaultValue("0")
offset: Int,
@QueryParam("limit")
@DefaultValue("10")
limit: Int): Response {
val posts = this.client.getAllPosts(q, offset, limit).entity as List<Post>
val count = this.client.countAllPosts(q).entity as Long
return ok(PostPage(posts, count)).build()
}
}
此Rest客户端接口的应用程序配置
com.example.PostResourceClient/mp-rest/url=http://localhost:8080
com.example.PostResourceClient/mp-rest/scope=javax.inject.Singleton
完整的代码是。重复的,这是一个客户端问题。请参阅原始SO答案中的解决方法
已在MicroporFile RestClient上打开一个问题以对此进行修复,并在Quarkus问题追踪器上跟踪该问题:与它一起复制的是MicroporFile RestClient问题。请参阅原始SO答案中的解决方法
已在MicroProfile RestClient上打开一个问题以对此进行修复,并在Quarkus问题追踪程序上进行跟踪:
com.example.PostResourceClient/mp-rest/url=http://localhost:8080
com.example.PostResourceClient/mp-rest/scope=javax.inject.Singleton