Guide to Installing and Using MinIO with Spring Boot for Object Storage
This article provides a comprehensive tutorial on MinIO, covering its features, application scenarios, Docker installation on CentOS 7, firewall configuration, Spring Boot integration, chunked upload implementation, and testing, complete with code examples and troubleshooting tips.
MinIO is an open‑source object storage server that runs on Linux, Windows, and macOS, offering simple, scalable, and highly available storage for objects, blocks, and files.
The article outlines MinIO's main features—easy installation, scalability, high availability, security, multi‑language support, community backing, and support for object, block, and file storage—and describes typical use cases such as large‑scale data storage, media storage, cloud‑native applications, data protection, and distributed computing.
It then details how to implement chunked, instant, and resumable uploads using Spring Boot and MinIO, explaining the steps of front‑end file slicing, uploading each part to MinIO via its Java SDK, merging parts on the server, handling instant uploads by checking file MD5, and managing errors.
The guide proceeds with a step‑by‑step CentOS 7 installation of MinIO using Docker, including commands to create a directory, pull the MinIO image, run the container with appropriate ports, environment variables, and network settings, and resolve common firewall‑related errors.
Next, it shows how to set up a Spring Boot project: adding MinIO dependencies, configuring server ports, multipart limits, and MinIO credentials in application.yml , creating a configuration class annotated with @Configuration and @ConfigurationProperties , and building a MinioClient bean.
A utility class MinioUtils is provided with methods to check and create buckets, generate upload policies, obtain presigned URLs, upload files, download files, and retrieve file URLs, all using the MinIO Java SDK and handling various exceptions.
The article also includes an AjaxResult class for standardized API responses and a REST controller MinioFileUploadController exposing endpoints for file upload, download, and URL retrieval.
Finally, functional testing screenshots demonstrate large file uploads and the resulting file URLs, confirming the end‑to‑end workflow.
Code Ape Tech Column
Former Ant Group P8 engineer, pure technologist, sharing full‑stack Java, job interview and career advice through a column. Site: java-family.cn
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.