命名空間支援

Spring Batch Integration 在 1.3 版本中新增了專用的 XML 命名空間支援,旨在提供更輕鬆的配置體驗。若要使用命名空間,請將以下命名空間宣告新增至您的 Spring XML 應用程式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 應用程式 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 檔案。但是,由於無版本宣告始終使用最新的綱要,因此我們通常不建議將版本號碼附加到 XSD 名稱。新增版本號碼可能會在更新 Spring Batch Integration 相依性時產生問題,因為它們可能需要更新版本的 XML 綱要。