Quarkus无法在通用模块中加载@ApplicationScope

时间:2019-10-15 14:19:18

标签: quarkus

我正在使用quarkus构建一个模块化项目。该项目由两个API模块和commons模块组成。我的想法是o将所有存储库都放入通用模块中,以通过两个API访问它们。当我尝试在通用模块中创建存储库时,其他模块无法加载它们。我得到了:

[error]: Build step io.quarkus.hibernate.validator.deployment.HibernateValidatorProcessor#build threw an exception: java.lang.NullPointerException;

公共模块已经使用Jandex插件。

请检查:https://github.com/sousadax12/quarkus-modules-test/tree/master

1 个答案:

答案 0 :(得分:0)

当我用quarkus:dev运行api-one时

Caused by: java.lang.ClassCastException: com.airhacks.full.boundary.TestRepository_ClientProxy cannot be cast to com.airhacks.full.boundary.TestRepository

但是从理论上讲它应该起作用。因为毕竟这是java。因此,在安装mvn之后,我使用

从命令行运行了它
PS D:\tmp\quarkus-modules-test\api-one> java -jar .\target\api-one-1.0-SNAPSHOT-runner.jar
2019-12-13 16:35:09,690 WARN  [io.qua.jae.run.JaegerDeploymentRecorder] (main) Jaeger service name has not been defined, either as 'quarkus.jaeger.service-name' application property or JAEGER_SERVICE_NAME environment variable/system property
2019-12-13 16:35:10,660 WARN  [io.qua.sch.run.QuartzScheduler] (main) No @Scheduled methods found, scheduler will not be started.
2019-12-13 16:35:10,674 INFO  [io.quarkus] (main) api-one 1.0-SNAPSHOT (running on Quarkus 0.25.0) started in 2.739s. Listening on: http://0.0.0.0:8080
2019-12-13 16:35:10,675 INFO  [io.quarkus] (main) Profile prod activated.
2019-12-13 16:35:10,680 INFO  [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-orm, hibernate-validator, jaeger, jdbc-h2, narayana-jta, resteasy, resteasy-jsonb, scheduler, security, servlet, smallrye-context-propagation, smallrye-fault-tolerance, smallrye-health, smallrye-metrics, smallrye-openapi, smallrye-opentracing, undertow-websockets]

我也只添加了一种证明来确保。这是输出

[{"name":"name"}]
在浏览器中

api-one response to ping

因此,我认为quarkus:dev是一个不错的功能,但是还不能很好地处理多模块。所以坚持使用Java。

https://github.com/ozkanpakdil/quarkus-modules-test可以在此处找到运行示例,谢谢您的复制。我真的很感激。