首页 > 学院 > 开发设计 > 正文

Spring集成Camel

2019-11-06 07:04:24
字体:
来源:转载
供稿:网友

最近在做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包才能运行的!!!!

参考官网:点击打开链接


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表