A Spring Boot-based integration service designed to monitor a directory, process incoming files with metadata enrichment, and route them to specific target directories based on file types.
- Dual Configuration Support: Implementation of both modern Spring Integration Java DSL and сlassic XML Configuration.
- Content Enrichment: Every processed file is renamed with a unique UUID prefix and enriched with audit metadata (original filename, file size, and ingestion timestamp) stored in message headers.
- Structured Routing: Automatic file distribution:
.txtfiles are routed to thetarget_txtdirectory.- All other file types are routed to the
target_otherdirectory.
- Audit Logging: Integrated logging of processed file details via
LoggingHandler.
- Java 21
- Spring Boot 3.5.14
- Spring Integration (File Support)
- JUnit 5 & Mockito (Testing)
- Awaitility (Asynchronous testing)
Ensure you have the following directories in the project root:
source(Input directory)target_txt(Output for text files)target_other(Output for other files)
You can switch between configurations using Spring Profiles:
./mvnw spring-boot:run -Dspring-boot.run.profiles=java./mvnw spring-boot:run -Dspring-boot.run.profiles=xmlThe project includes a comprehensive test suite to ensure reliability:
- Unit Tests (
FileProcessingServiceTest): Verifies the core business logic, ensuring files are correctly renamed and headers are populated with the required metadata. - Integration Tests (
FileTransferIntegrationTest): Validates the end-to-end flow from the inbound adapter through the router to the final file system destination usingActiveProfiles("java")and Awaitility for asynchronous verification.
com.file.transfer.config: ContainsJavaDslConfigfor the fluent API setup.com.file.transfer.service: ContainsFileProcessingService— the core logic.src/main/resources: Containsintegration-config.xmlfor the XML-based setup.