Spring Boot Came 单个 configl xml 模型中不接受多个骆驼上下文? [英] Multiple camel context not accepted in Spring Boot Came single configl xml model ?

查看:25
本文介绍了Spring Boot Came 单个 configl xml 模型中不接受多个骆驼上下文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本事实:Apache Camel 2.20.1 (Spring Boot)

尽管提供了显式不同的 id,但在同一个 spring boot config xml 中的多个上下文引用会抛出以下突出显示的错误

Multiple context reference in same spring boot config xml throws below highlighted error, despite providing explicit different ids

当我自己的例子失败时 - 我尝试了简单的示例案例..但遇到了同样的错误

在类路径资源中定义名称为typeConverter"的 bean 创建时出错 >[org/apache/camel/spring/boot/TypeConversionConfiguration.class]:不满意嵌套 > 异常是 org.springframework.beans.factory.NoUniqueBeanDefinitionException: > 没有可用的org.apache.camel.CamelContext"类型的合格 bean:预期 > 单个匹配 bean 但找到 2:camel1,camel2

Error creating bean with name 'typeConverter' defined in class path resource >[org/apache/camel/spring/boot/TypeConversionConfiguration.class]: Unsatisfied >dependency expressed through method 'typeConverter' parameter 0; nested >exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: >No qualifying bean of type 'org.apache.camel.CamelContext' available: expected >single matching bean but found 2: camel1,camel2

<!-- here we have the 1st CamelContext -->
<camelContext id="camel1" xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from uri="direct:one" />
        <to uri="mock:result" />
    </route>
</camelContext>

<!-- and there we have the 2nd CamelContext -->
<camelContext id="camel2" xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from uri="direct:two" />
        <to uri="log:two" />
        <to uri="mock:result" />
    </route>
</camelContext>

我的上下文正在从 Spring boot starter 类调用,如下所示.

My context are being called from Spring boot starter class as follows.

@SpringBootApplication
@ComponentScan(basePackages="com.wm")
@ImportResource("classpath:META-INF/spring/spring-context.xml")
public class ExtAuthServiceAppStarter {
    public static void main(String[] args) {
    SpringApplication.run(ExtAuthServiceAppStarter.class, args);
   }
}

有什么建议吗?

推荐答案

是的 Spring Boot 不是在同一个 JVM 中托管 N+ 应用程序的应用程序服务器.

Yes Spring Boot is not an application server to host N+ applications in the same JVM.

Camel on Spring Boot 经过优化并坚持只运行一个 CamelContext.

Camel on Spring Boot is optimized and adhered to run one CamelContext only.

这篇关于Spring Boot Came 单个 configl xml 模型中不接受多个骆驼上下文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆