An open API service indexing awesome lists of open source software.

https://github.com/vimal1464/spring-boot-media-service

This project aims to provide a straightforward solution for handling image data through a Spring Boot-based RESTful API. It leverages a MySQL database to store and retrieve images efficiently.
https://github.com/vimal1464/spring-boot-media-service

formdata jdbc multipart multipart-uploads mysql spring-boot

Last synced: 3 months ago
JSON representation

This project aims to provide a straightforward solution for handling image data through a Spring Boot-based RESTful API. It leverages a MySQL database to store and retrieve images efficiently.

Awesome Lists containing this project

README

        

# Spring Boot Media Service
[![Java Version](https://img.shields.io/badge/Java-17-green.svg)](https://docs.oracle.com/en/java/javase/11/)
[![Spring Boot Version](https://img.shields.io/badge/Spring%20Boot-3.2.0-green.svg)](https://spring.io/projects/spring-boot)
[![Spring Security Version](https://img.shields.io/badge/Spring%20Security-green.svg)](https://spring.io/projects/spring-security)
[![JWT Version](https://img.shields.io/badge/JWT-0.11.5-green.svg)](https://github.com/jwtk/jjwt)
[![MySQL Version](https://img.shields.io/badge/MySQL-8.0-blue.svg)](https://www.mysql.com/)

Welcome to the Spring Boot Media Service! This is a simple Spring Boot REST API service designed for storing image data in a MySQL database and retrieving it later.

## Table of Contents
- [Introduction](#introduction)
- [Clone and Run](#clone-and-run)
- [Features](#features)
- [Getting Started](#getting-started)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)

## Introduction

This project aims to provide a straightforward solution for handling image data through a Spring Boot-based RESTful API. It leverages a MySQL database to store and retrieve images efficiently.

## Clone and Run

To clone and run this project locally, follow these steps:

1. Clone the repository:
```bash
git clone https://github.com/Vimal1464/spring-boot-media-service.git
```

2. Navigate to the project directory:
```bash
cd spring-boot-media-service
```

3. Build the project using Maven:
```bash
mvn clean install
```

4. Run the application:
```bash
java -jar target/spring-boot-media-service.jar
```

The application will start, and you can access the API at [http://localhost:8080](http://localhost:8080).

## Features

- **Image Storage:** Upload and store image files in the MySQL database.
- **Image Retrieval:** Retrieve previously stored images based on their unique identifiers.

## Getting Started

Make sure you have the following prerequisites installed on your machine:

- Java Development Kit (JDK)
- Maven
- MySQL database

Update the `application.properties` file with your MySQL database configuration.

```properties
spring.datasource.url=jdbc:mysql://localhost:3306/your_database
spring.datasource.username=your_username
spring.datasource.password=your_password
```

## Usage

1. **Upload Image:**
- Send a POST request to `/file/upload` with the image file as a multipart form data.
- Example:
```bash
curl -X POST -H "Content-Type: multipart/form-data" -F "file=@/path/to/your/image.jpg" http://localhost:8080/file/upload
```

2. **Retrieve Image:**
- Send a GET request to `/file/{imagename}` to retrieve the image with the specified Image Name.
- Example:
```bash
curl http://localhost:8080/file/test.png --output retrieved_image.jpg
```

3. **Additional Operations:**
- Explore other API endpoints for more operations, such as listing all images or deleting an image.

## Contributing

Feel free to contribute to the development of this project. Fork the repository, make your changes, and submit a pull request.