【发布时间】:2016-12-15 11:41:53
【问题描述】:
我尝试了不同的方法来使用 cdi.main 创建一个独立的骆驼
org.apache.camel.cdi.Main.main();
//not org.apache.camel.Main
我还配置了 deltaspike,我看到了 cdi 容器,但是我的 CamelContext 没有启动。
如果有人已经独立运行了 Camel boot cdi,您可以发送代码吗?
更新: 我不断收到这种错误:
org.apache.webbeans.exception.WebBeansDeploymentException: javax.enterprise.inject.AmbiguousResolutionException: There is more than one Bean with type org.apache.camel.CamelContextQualifiers: [@javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name : ctx, Bean Owner : [ContextInitializer, WebBeansType:MANAGED, Name:null, API Types:[java.lang.Object,proj.core.ContextInitializer], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
found beans:
CdiCamelContext, WebBeansType:THIRDPARTY, Name:CamelContext, API Types:[org.apache.camel.CamelContext,org.apache.camel.cdi.CdiCamelContext,java.lang.Object], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any] from jar:file:/P:/atos/common/apache-maven-repo/org/apache/camel/camel-cdi/2.16.1/camel-cdi-2.16.1.jar!/org/apache/camel/cdi/CdiCamelContext.class
CamelContext, WebBeansType:PRODUCERMETHOD, Name:null, API Types:[org.apache.camel.CamelContext,org.apache.camel.SuspendableService,org.apache.camel.RuntimeConfiguration,java.lang.Object,org.apache.camel.Service], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any] from file:/P:/atos/proj-vnext/proj-core/target/classes/proj/core/CamelContextFactory.class
【问题讨论】:
-
查看现有的 CDI 示例
-
我确实查看了文档以及 github 存储库,但无法使其作为独立应用程序运行。我尝试使用 apache open webbeans 对其进行配置,但使用 ApplicationScope 的 camelContext 从未启动。我的配置肯定有问题,如果有人对配置也有问题,我会回来发布配置
-
另一件事是指可以从此处找到的示例:camel.apache.org/camel-boot.html 或 github 存储库中的某个位置。 (我只找到了一个没有cdi的独立应用)
标签: apache-camel cdi