檔案支援

Spring Integration 的檔案支援透過專用的詞彙擴展了 Spring Integration 核心,以處理檔案的讀取、寫入和轉換。

您需要將此依賴項包含到您的專案中

  • Maven

  • Gradle

<dependency>
    <groupId>org.springframework.integration</groupId>
    <artifactId>spring-integration-file</artifactId>
    <version>6.3.5</version>
</dependency>
compile "org.springframework.integration:spring-integration-file:6.3.5"

它提供了一個命名空間,該命名空間啟用了定義專用於檔案的通道配接器的元素,並支援可以將檔案內容讀取到字串或位元組陣列中的轉換器。

本節說明 FileReadingMessageSourceFileWritingMessageHandler 的工作原理,以及如何將它們設定為 Bean。它還討論了透過檔案特定實作的 Transformer 來處理檔案的支援。最後,它解釋了檔案特定的命名空間。