File Support
Spring Integration 的文件支持扩展了 Spring Integration Core,使其具备专门用于处理文件读取、写入和转换的词典。
Spring Integration’s file support extends the Spring Integration core with a dedicated vocabulary to deal with reading, writing, and transforming files.
你需要将此依赖项包含在你的项目中:
You need to include this dependency into your project:
-
Maven
-
Gradle
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-file</artifactId>
<version>{project-version}</version>
</dependency>
compile "org.springframework.integration:spring-integration-file:{project-version}"
它提供了一个名称空间,使可以定义专门针对文件的通道适配器的元素,并且支持可以将文件内容读入字符串或字节数组的转换器。
It provides a namespace that enables elements defining channel adapters dedicated to files and support for transformers that can read file contents into strings or byte arrays.
此部分介绍了 FileReadingMessageSource
和 FileWritingMessageHandler
的工作原理以及如何将它们配置为 Bean。它还讨论了如何通过 Transformer
的特定于文件的实现来处理文件。最后,它解释了特定于文件的名称空间。
This section explains the workings of FileReadingMessageSource
and FileWritingMessageHandler
and how to configure them as beans.
It also discusses the support for dealing with files through file-specific implementations of Transformer
.
Finally, it explains the file-specific namespace.