#1
When you're building modern applications—whether it's a media platform, a document manager, or even a simple file-sharing app—you'll often need a place to store files. Not just any place, but something fast, scalable, and easy to use. That's where MinIO comes in. It's an open-source tool that acts like Amazon S3 (a cloud-based storage system), but you can run it anywhere—even on your laptop.
In this guide, you’ll learn how to prepare a Spring Boot project for working with MinIO. We’re not jumping into any code yet—this article is all about setting the stage so you’re ready to go when it’s time to plug everything in.

Why Use Spring Boot with MinIO?

Spring Boot makes it really simple to build web apps and services quickly. MinIO is fast, lightweight, and plays nicely with tools that use the S3 API. When you use them together, you get a flexible and powerful setup without relying on third-party cloud services.

What makes this combo so good?

  • You can run MinIO on your own machine with Docker.
  • No need for AWS or other cloud providers.
  • Works with tools designed for Amazon S3.
  • Super lightweight and easy to manage.

What You’ll Need Before You Start

Let’s make sure your machine is ready to roll. You’ll need the following installed:

  • Java 17 or later (Java 11 also works)
  • Maven or Gradle (your build tool of choice)
  • An IDE like IntelliJ IDEA, Eclipse, or Visual Studio Code
  • Docker (for running MinIO locally)
  • A working Internet connection (for downloading dependencies)

Step 1: Create Your Spring Boot Project

There are several ways to start a Spring Boot project. You can use a web tool, your terminal, or your IDE.

Option A: Using Spring Initializr (The Web Way)

  1. Go to https://start.spring.io
  2. Choose:
    • Project: Maven or Gradle
    • Language: Java
    • Spring Boot Version: Pick the latest stable one
    • Group: com.example
    • Artifact: minio-demo
    • Name: minio-demo
    • Packaging: Jar
    • Java Version: 17
    • Click Generate to download your project.
    • Unzip it and open it in your favorite IDE.

Option B: Using Spring Boot CLI (The Terminal Way)

spring init --dependencies=web minio-demo cd minio-demo

Step 2: Add MinIO Dependencies

To talk to MinIO from your app, you’ll need the MinIO Java SDK. You can also use the AWS SDK since MinIO speaks the same “language” as Amazon S3.

Using Maven?

Open your pom.xml and add this:

<dependency>
    <groupId>io.minio</groupId>
    <artifactId>minio</artifactId>
    <version>8.5.7</version> <!-- Use the latest version -->
</dependency>

Using Gradle?

Open your build.gradle and add:

implementation 'io.minio:minio:8.5.7' // Use the latest version

You might also want to include:

  • spring-boot-starter-web – for building web APIs
  • spring-boot-configuration-processor – for config binding
  • spring-boot-starter-validation – optional, for request validation

Step 3: Run MinIO Using Docker

Step 4: Think Through Your App’s File Handling

Before jumping into coding, think about how your app will work with files. Ask yourself:

  • Should users be able to upload and download files?
  • Do I need to create new buckets on the fly?
  • Will the app handle large files or use streaming?
  • Will I use separate settings for development and production?
  • Do I need to secure files with signed URLs or access tokens?

Taking the time to answer these now will save you lots of trouble later.
You might want to plan for:

  • A MinioService class to manage file logic
  • A config class to load your MinIO settings
  • Some integration tests to make sure file upload/download works
  • A properties or YAML file to manage settings per environment

Step 5: Organize Your Codebase

Here’s a simple structure that works well:

src
├── main
│   ├── java
│   │   └── com.example.miniodemo
│   │       ├── MinioDemoApplication.java
│   │       ├── config
│   │       │   └── MinioConfig.java          # For config later
│   │       ├── service
│   │       │   └── MinioService.java         # File logic
│   │       └── controller
│   │           └── FileController.java       # API endpoints
│   └── resources
│       └── application.yml                   # Configuration file

This layout keeps things clean and ready for future expansion.

Step 6: Next Steps

Awesome—you’ve got the base project set up! Coming up next, you’ll need to:

  • Add your MinIO settings in application.yml or .properties
  • Build a client using the MinIO SDK
  • Create services to upload, download, and delete files
  • Write REST APIs for the front-end to use

Each of these steps builds on the solid base you just created.


image quote pre code