檔案支援
Spring Integration 的檔案支援擴充套件了 Spring Integration 核心,並提供了一套專門的詞彙表來處理檔案的讀取、寫入和轉換。
專案需要此依賴項
-
Maven
-
Gradle
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-file</artifactId>
<version>7.0.0</version>
</dependency>
compile "org.springframework.integration:spring-integration-file:7.0.0"
它提供了一個名稱空間,該名稱空間支援定義專門用於檔案的通道介面卡元素,並支援可以將檔案內容讀取為字串或位元組陣列的轉換器。
本節解釋了 FileReadingMessageSource 和 FileWritingMessageHandler 的工作原理以及如何將它們配置為 bean。它還討論了透過 Transformer 的檔案特定實現來處理檔案的支援。最後,它解釋了檔案特定的名稱空間。