|
当前版本仍在开发中,尚不被视为稳定版本。最新稳定版请使用 Spring Batch 文档 6.0.2! |
命名空间支持
Spring Batch 集成从 1.3 版本开始加入了专用的 XML 命名空间支持,目的是提供更简洁的配置体验。要使用该命名空间,需要在 Spring XML Application Context 文件中加入如下命名空间声明:
<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 application context 文件:
<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 文件名后追加版本号也是允许的。不过,由于不带版本号的声明总是会使用最新 schema,因此通常不建议在 XSD 名称中显式追加版本号。加入版本号后,在升级 Spring Batch Integration 依赖时可能会带来问题,因为新版本依赖可能要求更新的 XML schema。
batch-integration XML 命名空间从 Spring Batch 6.0 开始已被弃用,并将在 7.0 版本中移除。
|