Cloud Native 23 min read

Guide to Installing and Using MinIO with Spring Boot and Docker

This article provides a comprehensive guide to installing MinIO on CentOS 7, configuring it with Docker, integrating it into a Spring Boot application, and implementing file upload, download, and multipart upload features using MinIO's Java SDK, along with troubleshooting tips and code examples.

Java Architect Essentials
Java Architect Essentials
Java Architect Essentials
Guide to Installing and Using MinIO with Spring Boot and Docker

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.

Key features include easy installation, horizontal scalability, high availability with redundancy and replication, security via SSL/TLS and access control, multi‑language SDK support, and strong community backing.

Typical application scenarios cover large‑scale data storage, media asset management, cloud‑native applications (Kubernetes, Docker Swarm), data protection and disaster recovery, as well as distributed computing and machine learning workloads.

Installing MinIO on CentOS 7

Create a directory for MinIO:

mkdir minio

Pull the MinIO Docker image and run it with appropriate ports, network mode, and credentials:

docker pull minio/minio
docker run -p 9000:9000 -p 9090:9090 \
    --net=host \
    --name minio \
    -d --restart=always \
    -e "MINIO_ACCESS_KEY=IT@WangHui" \
    -e "MINIO_SECRET_KEY=IT@WangHui" \
    minio/minio server /data --console-address ":9000" -address ":9090"

Ensure firewall rules allow ports 9000 and 9090:

firewall-cmd --zone=public --add-port=9000/tcp --permanent
firewall-cmd --zone=public --add-port=9090/tcp --permanent
firewall-cmd --reload

Access the MinIO console at http://localhost:9000 using the provided access key and secret key.

Spring Boot Integration

Add the MinIO Java client dependency:

<dependency>
    <groupId>io.minio</groupId>
    <artifactId>minio</artifactId>
    <version>8.5.2</version>
</dependency>

Configure MinIO properties in application.yml (or application.properties ) and create a configuration class annotated with @Configuration and @ConfigurationProperties(prefix="spring.minio") to expose accessKey , secretKey , url , and bucketName .

Define a MinioConfig bean that builds a MinioClient using the configured endpoint and credentials.

Utility Class

The MinioUtils component provides methods to:

Check and create buckets ( existBucket , makeBucket ).

Generate presigned upload policies ( getPolicy ).

Upload files ( upload ).

Download files and return ResponseEntity<byte[]> ( download ).

Obtain presigned URLs for objects ( getUrl , getFileUrl ).

Controller

A REST controller MinioFileUploadController exposes endpoints to upload files, download files, and retrieve file URLs, returning results wrapped in an AjaxResult structure.

Testing

Large file uploads and generated URLs are demonstrated with screenshots, confirming successful integration.

Conclusion

The guide combines installation, Docker deployment, Spring Boot configuration, and practical code examples to help developers quickly adopt MinIO for object storage in cloud‑native Java applications.

JavaDockerSpring BootMinIOobject storage
Java Architect Essentials
Written by

Java Architect Essentials

Committed to sharing quality articles and tutorials to help Java programmers progress from junior to mid-level to senior architect. We curate high-quality learning resources, interview questions, videos, and projects from across the internet to help you systematically improve your Java architecture skills. Follow and reply '1024' to get Java programming resources. Learn together, grow together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.