Getting Started with MinIO: Installation, Features, and Spring Boot Integration for File Upload
This article introduces the open‑source MinIO object storage system, outlines its high‑performance and cloud‑native features, provides step‑by‑step Docker installation and UI configuration, and demonstrates how to integrate MinIO with Spring Boot for secure file uploads via SDKs.
MinIO is an open‑source, Golang‑based object storage suite licensed under Apache v2.0, offering high performance (up to 55 Gb/s read and 35 Gb/s write), scalability up to 5 TB per object, S3 compatibility, cloud‑native deployment, erasure‑code protection, and SDKs for Go, Java, and Python.
Typical use cases include private cloud object storage and acting as a gateway for public cloud services such as Amazon S3 or Microsoft Azure.
Installation can be done quickly with Docker:
docker pull minio/minio docker run -p 9000:9000 -p 9001:9001 --name minio -d --restart=always -e "MINIO_ACCESS_KEY=admin" -e "MINIO_SECRET_KEY=admin" -v /home/data:/data -v /home/config:/root/.minio minio/minio server --console-address ":9000" --address ":9001" /dataThe -p option maps port 9000 for the web console and port 9001 for the API; MINIO_ACCESS_KEY and MINIO_SECRET_KEY set the console credentials.
After starting the container, access the console at http://<em>ip</em>:9000/login, create a bucket (e.g., test), and set its policy to public.
Spring Boot Integration :
Add the MinIO Maven dependency:
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>8.2.1</version>
</dependency>Configure connection details in application.yml (endpoint, port, accessKey, secretKey, bucket name, size limits, etc.).
Create a REST controller to handle file uploads using the MinIO SDK:
@RequestMapping("/minio")
@RestController
public class MinioController {
@Autowired
private MinioService minioService;
@PostMapping("/upload")
public String uploadFile(MultipartFile file, String bucketName) {
String fileType = FileTypeUtils.getFileType(file);
if (fileType != null) {
return minioService.putObject(file, bucketName, fileType);
}
return "Unsupported file format. Please verify and re‑upload!";
}
}Testing the endpoint returns a URL that can be accessed directly; the uploaded file appears in the MinIO UI and can be shared with a 7‑day expiration link.
In summary, MinIO provides a powerful, lightweight, and free object storage solution suitable for small projects, personal image hosting, or as a component in larger cloud‑native architectures.
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.
