gpt4 book ai didi

java - 使用 RestEasy Reactive 库中的 RestResponse 时出错

转载 作者:行者123 更新时间:2023-12-03 08:13:12 25 4
gpt4 key购买 nike

我正在尝试使用RestResponse<T>来自 org.jboss.resteasy.reactive 的对象自javax.ws.rs.core.Response以来我的应用程序资源返回不提供泛型类型。

当我调用此端点时收到错误:

public RestResponse<List<SampleResponse>> findAll() {
return ResponseBuilder.ok(sampleService.findAll()).build();
}

错误:

Request failed: java.lang.ClassCastException: class org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl cann
ot be cast to class org.jboss.resteasy.reactive.common.jaxrs.RuntimeDelegateImpl (org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl and org.jboss.resteasy.reactive.common.jaxrs.RuntimeDelegateImpl are in unnamed mo
dule of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @3c153a1)

我在 pom.xml 中的依赖项:

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-liquibase</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-health</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-redis-client</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-config-yaml</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-spring-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-postgresql</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-spring-web</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive</artifactId>
</dependency>
</dependencies>

最佳答案

我刚刚解决了这个问题...这是依赖关系的顺序。我将 quarkus-resteasy-reactive 切换到顶部,它现在正在工作。

关于java - 使用 RestEasy Reactive 库中的 RestResponse 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70248211/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com