How hsupadhyay99/spring-boot-upload-multiple-files works
Project type and purpose
• This is a Spring Boot “file‐upload” microservice (a backend REST API) whose sole responsibility is to accept, store, and serve multiple files.
File structure
• Top‐level build and config:
• .mvn/, mvnw, pom.xml → Maven wrapper and build configuration
• src/main/resources/application.properties → service configuration (file storage path, port, etc.)
• Main code under src/main/java/com/hari/spring/files/uploadmultiple/:
• SpringBootUploadMultipleFilesApplication.java → entry point (Bootstraps embedded Tomcat)
• controller/FilesController.java → REST endpoints for upload, download, list
• service/FilesStorageService(.java/.impl) → business logic for saving and retrieving files
• model/FileInfo.java → metadata representation of stored files
• message/ResponseMessage.java → wrapper for API responses
• exception/FileUploadExceptionAdvice.java → centralized exception‐to‐HTTP mapping
• Tests under src/test/java/com/bezkoder/... mirror the main package structure and validate the core upload/download functionality.
Key architectural insights from the (empty) README and code
• Follows a classic layered, MVC‐style pattern:
Client ↔ Controller (REST) ↔ Service ↔ Storage (file system)
• Uses embedded Tomcat (via Spring Boot Starter Web)
• File storage is local (no database), configured via application.properties
• Exception handling is factored out into an “advice” class