Spring boot 将Camel-springxml移动到Spring引导
我想将我们的几个camel应用程序迁移到springboot。我发现的大多数示例都使用JavaDSL。我们目前支持的应用程序都基于SpringXML 我应该采取什么步骤将这些应用程序迁移到Spring Boot。如果我使用FatJarRouter,我的理解是驼峰上下文已经自动配置好了,所以在我看来,我应该能够在SpringXML中定义路由Spring boot 将Camel-springxml移动到Spring引导,spring-boot,apache-camel,Spring Boot,Apache Camel,我想将我们的几个camel应用程序迁移到springboot。我发现的大多数示例都使用JavaDSL。我们目前支持的应用程序都基于SpringXML 我应该采取什么步骤将这些应用程序迁移到Spring Boot。如果我使用FatJarRouter,我的理解是驼峰上下文已经自动配置好了,所以在我看来,我应该能够在SpringXML中定义路由 @SpringBootApplication @ImportResource("classpath:camel-context.xml") public cl
@SpringBootApplication
@ImportResource("classpath:camel-context.xml")
public class CamelApplication extends FatJarRouter {
public static void main(String[] args) {
SpringApplication.run(CamelApplication.class, args);
}
@Bean
String myBean() {
return "I'm Spring bean!";
}
}
camel-context.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<routes xmlns="http://camel.apache.org/schema/spring">
<route id="test">
<from uri="timer://trigger"/>
<transform>
<simple>ref:myBean</simple>
</transform>
<to uri="log:out"/>
</route>
</routes>
</beans>
请参阅本页底部的“如何包含XML路由”:
2015-11-13 15:59:13.734 WARN 2156 --- [on(5)-127.0.0.1] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Cannot locate BeanDefinitionParser for element [routes]
Offending resource: class path resource [camel-context.xml]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.fatal(FailFastProblemReporter.java:60) ~[spring-beans-4.2.2.RELEASE.jar:na]
at org.springframework.beans.factory.parsing.ReaderContext.fatal(ReaderContext.java:68) ~[spring-beans-4.2.2.RELEASE.jar:na]