Quarkus Restclient 抛出 javax.enterprise.inject.UnsatisfiedResolutionException: unsatisfied 依赖项的类型和<



我正试图将第二个rest客户端集成到我的微服务中,并得到一个错误。

@RegisterRestClient
public interface <my-interface> {
@POST
@Path("/example")
Response postStuff(DataBean data);
}

注入类的操作如下:

@Inject @Any
protected <my-interface> api;

下面是错误信息:

javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type <my-class> and qualifiers [@Any]

我已经看到这个问题弹出了很多,但添加@ApplicationScoped或@Singleton不适合我。据我所知,@Path注释应该使接口可被发现。我的另一个接口没有任何问题,我不知道为什么。

感谢帮助:)

使用@RestClient注释进行注入:

@RestClient
protected <my-interface> api;

正如Kerim所说。您需要在应用程序中定义作用域。使用其余客户端:创建配置(Quarkus)

最新更新