跳到主要内容

命名空间支持

QWen Plus 中英对照 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>
xml

以下示例展示了一个为 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>
xml

在引用的 XSD 文件后添加版本号也是允许的。然而,由于无版本的声明总是使用最新的模式,我们通常不建议在 XSD 名称后附加版本号。添加版本号可能会在更新 Spring Batch Integration 依赖项时引发问题,因为这些依赖项可能需要更 recent 的 XML 模式版本。