Namespace Support

专用 XML 命名空间支持已添加到 Spring Batch Integration 1.3 版,目的是提供更容易的配置体验。若要使用该命名空间,请将以下命名空间申明添加到你的 Spring XML 应用程序上下文文件:

<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:batch-int="http://www.springframework.org/schema/batch-integration"
  xsi:schemaLocation="
    http://www.springframework.org/schema/batch-integration
    https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">

    ...

</beans>

以下示例展示了一个针对 Spring Batch Integration 完整配置的 Spring XML 应用程序上下文文件:

<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:int="http://www.springframework.org/schema/integration"
  xmlns:batch="http://www.springframework.org/schema/batch"
  xmlns:batch-int="http://www.springframework.org/schema/batch-integration"
  xsi:schemaLocation="
    http://www.springframework.org/schema/batch-integration
    https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd
    http://www.springframework.org/schema/batch
    https://www.springframework.org/schema/batch/spring-batch.xsd
    http://www.springframework.org/schema/beans
    https://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/integration
    https://www.springframework.org/schema/integration/spring-integration.xsd">

    ...

</beans>

将版本号追加到引用的 XSD 文件中也是允许的。但是,因为无版本申明始终使用最新的架构,所以我们通常不建议将版本号追加到 XSD 名称。添加版本号在更新 Spring Batch Integration 依赖关系时可能会产生问题,因为它们可能需要 XML 架构的更新版本。