gpt4 book ai didi

java - CamelContext 与 Spring

转载 作者:行者123 更新时间:2023-12-01 11:30:56 25 4
gpt4 key购买 nike

我的camel-server.xml 和 Spring 集成遇到某种配置问题。

我创建了一个名为camel-server.xml的文件,其中包含Camel在使用SpringBoot运行部署应用程序时所需的路由、bean和其他导入语句。

但是,我有一个奇怪的错误:

Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.apache.camel.CamelContext] is defined: expected single matching bean but found 2: camel-server,camelContext

我真的不明白为什么 Spring 找到了两个 bean,因为我认为我只声明了一个。请参阅下面的“camel-server.xml”。

<!-- CXF Spring Config -->
<import resource="classpath:META-INF/spring/cxf-server.xml" />

<!-- Bridge Spring property placeholder with Camel, using Archaius as the Source
You must NOT use the <context:property-placeholder> at the same time, only this bridge bean -->
<bean id="properties" class="com.capgemini.archaius.spring.ArchaiusBridgePropertyPlaceholderConfigurer">
<!-- This must come before the locations -->
<property name="ignoreResourceNotFound" value="true" />
<property name="initialDelayMillis" value="1000" />
<property name="delayMillis" value="1000" />
<property name="ignoreDeletesFromSource" value="false" />
<property name="locations">
<list>
<value>classpath:/META-INF/spring/lrit-emsa-asp-activemq.properties</value>
<value>classpath:/META-INF/spring/lrit-emsa-asp-camel.properties</value>
</list>
</property>
</bean>

<!-- CamelContext -->
<camelContext id="camel-server" trace="true" xmlns="http://camel.apache.org/schema/spring">
<camel:jmxAgent id="camel-server-jmx" createConnector="true" connectorPort="9004"/>
<camel:routeBuilder ref="xxxRoute" />
</camelContext>

<!-- Service Activator Spring Beans -->
<!-- All Service Activator spring beans are located in and annotated with @Component -->
<!-- Additionally, these beans have @Profile annotations indicating when they should be enabled. -->
<!-- Those annotated "default" will always be turned on, unless another bean with the same id (value) is turned on. -->
<!-- To enable a profile, add -Dspring.profiles.active="profile, names, here" to the startup command line -->
<context:component-scan base-package="xxx.yyy.zzz.serviceactivator" />

<!-- Spring Boot Starter Bean -->
<bean id="application" class="xxx.yyy.zzz.Application" />

<!-- Routes -->
<bean id="xxxRoute" class="xxx.yyy.zzz.route.XXXRoute"/>

<!-- Transformers -->
<bean id="pollingRequestTransformer" class="xxx.yyy.zzz.bean.pollingrequest.PollingRequestTransformer"/>

我的CXF服务器XML如下:

<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

<cxf:cxfEndpoint id="xyzPortType"
address="${xxx.yyy.services.soap.endpoint}"
wsdlURL="src/main/resources/META-INF/wsdl/ASP-DC.wsdl"
serviceClass="xxx.yyy.zzz.asp.wsdl.XyzPortTypeType"
serviceName="xxx:xxxService"
xmlns:xxx="http://yzs.abc.org/XML/xxx/2008">

<cxf:properties>
<entry key="dataFormat" value="PAYLOAD"/>
<entry key="loggingFeatureEnabled" value="true"/>
</cxf:properties>

</cxf:cxfEndpoint>

最佳答案

就是这样!谢谢您从我的应用程序类中删除了@EnableAutoConfiguration,它只查看了我的camer-server.xml。

关于java - CamelContext 与 Spring,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30392385/

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