我有一个带有工作休息端点的 Quarkus 应用程序(让我们将其命名为 cosmicApp)。我添加了一个 Maven 依赖项,其中有一些用 @Path
和 @GET
注释的类。但这些资源在应用程序运行时不可用。 cosmicApp 中的类使用添加的依赖项中的类,因此它应该在那里。
只是缺少资源。
有什么提示吗?
两个项目都使用
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jackson</artifactId>
</dependency>
Quarkus 版本 1.2.1.Final
最佳答案
我认为你必须以某种方式从依赖项中注册你的资源。一种可能的选择是在 config.properties 中提供配置参数来确定应包含在依赖项上下文中的 Artifact :
quarkus.index-dependency.<name>.group-id=<your dependency group ID>
quarkus.index-dependency.<name>.artifact-id=<your dependency artifact ID>
您还可以使用 beans.xml 或 Jandex 索引。请引用文档:https://quarkus.io/guides/cdi-reference
关于maven - 从依赖项加载资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60848123/