名稱空間支援

在 1.3 版本中,Spring Batch Integration 添加了專用的 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 檔案。但是,由於無版本宣告始終使用最新的 schema,因此我們通常不建議將版本號附加到 XSD 名稱。新增版本號可能會在更新 Spring Batch Integration 依賴項時產生問題,因為它們可能需要更新版本的 XML schema。