317.2. 添加 Camel Schema


对于 Camel 1.x,您需要使用以下命名空间:

http://activemq.apache.org/camel/schema/spring

使用以下架构位置:

http://activemq.apache.org/camel/schema/spring/camel-spring.xsd

您需要将 Camel 添加到 schemaLocation 声明中

http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd

因此,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">

317.2.1. 使用 camel: namespace

或者您可以在 XML 声明中引用 camel XSD:

xmlns:camel="http://camel.apache.org/schema/spring"
  1. 因此,声明为:
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:camel="http://camel.apache.org/schema/spring"
       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">
  1. 然后,使用 camel: 命名空间前缀,您可以省略内联命名空间声明:
<camel:camelContext id="camel5">
  <camel:package>org.apache.camel.spring.example</camel:package>
</camel:camelContext>
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.