檔案支援

Spring Integration 的檔案支援擴充套件了 Spring Integration 核心,提供了專門的詞彙表來處理檔案的讀取、寫入和轉換。

您需要在專案中包含此依賴項

  • Maven

  • Gradle

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

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

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