不是REST客户端接口:接口myclient。在班级或任何方法上都找不到@Path注释。...[Quarkus]
我有一个消耗API的项目,并且正在努力将其剩余客户注入我的服务。
是什么问题
(请注意,我主要在做另一个有效的实例中所做的事情,但是我无法确定我的客户界面
@org.eclipse.microprofile.rest.client.inject.RegisterRestClient(
configKey = "my.feature-service.baseUrl"
)
@org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders(MyCustomHeadersFactory.class)
@javax.ws.rs.Consumes({"application/vnd.cust.my-service-config+json;version=1.0;charset=UTF-8"})
@javax.ws.rs.Produces({"application/vnd.cust.my-service-config+json;version=1.0;charset=UTF-8"})
public interface FeatureServiceClient {
@javax.ws.rs.GET
@javax.ws.rs.Path("/v1/my/feature")
Uni<List<MyDto>> getPossibleFeatures();
//and several other methods
}
:在我的消费方面:
@javax.enterprise.context.ApplicationScoped
public class MyService {
@org.eclipse.microprofile.rest.client.inject.RestClient
FeatureServiceClient serviceClient;
}
但是,当它试图初始化时,我我得到了:
Caused by: java.lang.IllegalArgumentException: Not a REST client interface: interface my.feature.FeatureServiceClient. No @Path annotation found on the class or any methods of the interface and no HTTP method annotations (@POST, @PUT, @GET, @HEAD, @DELETE, etc) found on any of the methods
at org.jboss.resteasy.reactive.client.impl.ClientProxies.get(ClientProxies.java:26)
at org.jboss.resteasy.reactive.client.impl.WebTargetImpl.proxy(WebTargetImpl.java:382)
at io.quarkus.rest.client.reactive.runtime.RestClientBuilderImpl.build(RestClientBuilderImpl.java:273)
at io.quarkus.rest.client.reactive.runtime.RestClientCDIDelegateBuilder.build(RestClientCDIDelegateBuilder.java:76)
at io.quarkus.rest.client.reactive.runtime.RestClientCDIDelegateBuilder.createDelegate(RestClientCDIDelegateBuilder.java:57)
at io.quarkus.rest.client.reactive.runtime.RestClientReactiveCDIWrapperBase.<init>(RestClientReactiveCDIWrapperBase.java:16)
at my.feature.MyFeatureClient$$CDIWrapper.<init>(FeatureServiceClient$$CDIWrapper.zig:21)
at my.feature.MyFeatureClient$$CDIWrapper_ClientProxy.<init>(MyFeatureClient$$CDIWrapper_ClientProxy.zig:28)
at my.feature.MyFeatureClient$$CDIWrapper_Bean.proxy(FeatureServiceClient$$CDIWrapper_Bean.zig:40)
at my.feature.MyFeatureClient$$CDIWrapper_Bean.get(FeatureServiceClient$$CDIWrapper_Bean.zig:243)
at my.feature.MyFeatureClient$$CDIWrapper_Bean.get(FeatureServiceClient$$CDIWrapper_Bean.zig:259)
at my.consumer.Myservice_Bean.create(MyService_Bean.zig:175)
... 67 more
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>2.3.0.CR1</quarkus.platform.version>
I have a project that consumes an api and am struggling to get the Rest Client injected into my service.
(to note, i am mainly doing what i did in another instance that works however I can't pinpoint what's wrong here to make this one fail)
My Client interface:
@org.eclipse.microprofile.rest.client.inject.RegisterRestClient(
configKey = "my.feature-service.baseUrl"
)
@org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders(MyCustomHeadersFactory.class)
@javax.ws.rs.Consumes({"application/vnd.cust.my-service-config+json;version=1.0;charset=UTF-8"})
@javax.ws.rs.Produces({"application/vnd.cust.my-service-config+json;version=1.0;charset=UTF-8"})
public interface FeatureServiceClient {
@javax.ws.rs.GET
@javax.ws.rs.Path("/v1/my/feature")
Uni<List<MyDto>> getPossibleFeatures();
//and several other methods
}
on my consuming side I have:
@javax.enterprise.context.ApplicationScoped
public class MyService {
@org.eclipse.microprofile.rest.client.inject.RestClient
FeatureServiceClient serviceClient;
}
however when it tries to get initialised I am getting:
Caused by: java.lang.IllegalArgumentException: Not a REST client interface: interface my.feature.FeatureServiceClient. No @Path annotation found on the class or any methods of the interface and no HTTP method annotations (@POST, @PUT, @GET, @HEAD, @DELETE, etc) found on any of the methods
at org.jboss.resteasy.reactive.client.impl.ClientProxies.get(ClientProxies.java:26)
at org.jboss.resteasy.reactive.client.impl.WebTargetImpl.proxy(WebTargetImpl.java:382)
at io.quarkus.rest.client.reactive.runtime.RestClientBuilderImpl.build(RestClientBuilderImpl.java:273)
at io.quarkus.rest.client.reactive.runtime.RestClientCDIDelegateBuilder.build(RestClientCDIDelegateBuilder.java:76)
at io.quarkus.rest.client.reactive.runtime.RestClientCDIDelegateBuilder.createDelegate(RestClientCDIDelegateBuilder.java:57)
at io.quarkus.rest.client.reactive.runtime.RestClientReactiveCDIWrapperBase.<init>(RestClientReactiveCDIWrapperBase.java:16)
at my.feature.MyFeatureClient$CDIWrapper.<init>(FeatureServiceClient$CDIWrapper.zig:21)
at my.feature.MyFeatureClient$CDIWrapper_ClientProxy.<init>(MyFeatureClient$CDIWrapper_ClientProxy.zig:28)
at my.feature.MyFeatureClient$CDIWrapper_Bean.proxy(FeatureServiceClient$CDIWrapper_Bean.zig:40)
at my.feature.MyFeatureClient$CDIWrapper_Bean.get(FeatureServiceClient$CDIWrapper_Bean.zig:243)
at my.feature.MyFeatureClient$CDIWrapper_Bean.get(FeatureServiceClient$CDIWrapper_Bean.zig:259)
at my.consumer.Myservice_Bean.create(MyService_Bean.zig:175)
... 67 more
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>2.3.0.CR1</quarkus.platform.version>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,找到了解决方案。
我在模块中添加了以下构建插件,该模块
不确定哪些导致错误解决的问题,我不会期望任何丢失的人都有这样的错误。
So, found the solution.
I added the following build plugins to the module contianing my Client interface
not entirely sure which of those caused the error to get solved really and i wouldn't expect such an error for any of those being missing.