Spring集成Camel

来源:互联网 发布:网络直播名人排名 编辑:程序博客网 时间:2024/06/05 14:52

最近在做spring集成camel的项目,查看了官网和博客等其他的文章,总结了spring集成camel时需要做的几件事:


1.Adding Camel schema 在spring配置文件中添加spring集成camel需要的命名空间


2.Configure Routes in two ways:

2.1 Using Spring XML 

2.2 Using Java Code


Adding Camel Schema:

<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">

添加Camel路由:

<camelContext id="camel5" xmlns="http://camel.apache.org/schema/spring">      </camelContext>

注意:

网上几乎都是这种方式,我也按照这种方式试了一下午,始终没有成功,一直报错找不到 http://camel.apache.org/schema/spring 很是奇怪,直到后来才知道是导入jar包问题。导入jar如下:采用pom.xml方式


<dependency><groupId>org.apache.camel</groupId><artifactId>camel-core</artifactId><version>2.17.3<version></dependency><dependency><groupId>org.apache.camel</groupId><artifactId>camel-spring</artifactId><version>2.17.3<version></dependency>

当然还需要添加spring的jar包才能运行的!!!!

参考官网:点击打开链接





0 0
原创粉丝点击