命名空间支持
Spring Batch Integration 在 1.3 版本中添加了专用的 XML 命名空间支持, 旨在提供更简便的配置 体验。要使用该命名空间,请将以下 命名空间声明添加到您的 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 架构。
batch-integration XML 命名空间自 Spring Batch 6.0 起已弃用,并将在 7.0 版本中移除。 |