A simple Spring Boot REST API service that generates UUIDs with Swagger UI documentation.
- Generate single UUID
- Generate multiple UUIDs (bulk generation)
- Generate UUID with timestamp
- Swagger UI documentation
- CORS configuration
- Global exception handling
- Java 21
- Spring Boot 3.2.1
- Spring Web
- Springdoc OpenAPI (Swagger UI)
- Maven
- Java 21 or higher
- Maven 3.6+
mvn clean packageUsing Maven:
mvn spring-boot:runUsing JAR:
java -jar target/uuid-generator-1.0.0.jarThe application will start on port 8900.
The project includes a multi-stage Dockerfile optimized for size (under 100MB) using Alpine Linux and a custom JRE.
Build the Image:
docker build -t uuid-generator:minimal .Run the Container:
docker run -d -p 8900:8900 --name uuid-app uuid-generator:minimal| Method | Endpoint | Description |
|---|---|---|
| GET | /api/uuid |
Generate a single UUID |
| GET | /api/uuid/bulk?count=10 |
Generate multiple UUIDs (1-1000) |
| GET | /api/uuid/timestamp |
Generate UUID with timestamp |
Single UUID:
{
"uuid": "550e8400-e29b-41d4-a716-446655440000"
}Bulk UUIDs:
{
"uuids": [
"550e8400-e29b-41d4-a716-446655440000",
"6ba7b810-9dad-11d1-80b4-00c04fd430c8"
],
"count": 2
}UUID with Timestamp:
{
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"generatedAt": "2025-12-12T10:30:00.000Z"
}Access the interactive API documentation at:
- Swagger UI: http://localhost:8900/swagger-ui.html
- OpenAPI JSON: http://localhost:8900/api-docs
Run Tests:
mvn testTest with cURL:
# Single UUID
curl http://localhost:8900/api/uuid
# Bulk UUIDs
curl "http://localhost:8900/api/uuid/bulk?count=5"
# UUID with timestamp
curl http://localhost:8900/api/uuid/timestampConfiguration is managed in application.properties:
| Property | Default | Description |
|---|---|---|
server.port |
8900 | Server port |
springdoc.swagger-ui.path |
/swagger-ui.html | Swagger UI path |

