https://github.com/mmushfiq/springboot-microservice-template
Spring Boot microservice template implemented using Spring Boot 3.3 and Java 21
https://github.com/mmushfiq/springboot-microservice-template
archunit docker-compose gradle-8 java-21 junit5 liquibase mongock mongodb opentelemetry postgresql rabbitmq redis spring-boot-3
Last synced: 17 days ago
JSON representation
Spring Boot microservice template implemented using Spring Boot 3.3 and Java 21
- Host: GitHub
- URL: https://github.com/mmushfiq/springboot-microservice-template
- Owner: mmushfiq
- License: apache-2.0
- Created: 2025-02-24T19:35:57.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-12-12T07:13:27.000Z (4 months ago)
- Last Synced: 2025-12-13T06:47:07.784Z (3 months ago)
- Topics: archunit, docker-compose, gradle-8, java-21, junit5, liquibase, mongock, mongodb, opentelemetry, postgresql, rabbitmq, redis, spring-boot-3
- Language: Java
- Homepage:
- Size: 143 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Spring Boot Microservice Template











This is a template Spring Boot microservice implemented using **Spring Boot 3.3** and **Java 21**. It demonstrates the integration of various technologies and best practices for building microservices. Additionally, it showcases the usage of the [Common Library](https://github.com/mmushfiq/springboot-microservice-common-lib).
`{PN}` - _project name or project name abbreviation_
**Note:** This repository does not represent real-world business scenarios; the examples are solely intended to demonstrate the usage of various technologies.
## Technologies and Tools Used
This template integrates multiple tools and frameworks, including:
- **Docker Compose** - For containerized dependencies.
- **PostgreSQL** - Relational database.
- **Liquibase** - Database migration tool for PostgreSQL.
- **MongoDB** - NoSQL database.
- **Mongock** - Database migration tool for MongoDB.
- **Redis** - In-memory caching system.
- **RabbitMQ** - Message broker for event-driven communication.
- **ShedLock** - Ensures scheduled tasks run in distributed environments.
- **Logstash/Logback** - Centralized logging.
- **Checkstyle** - Code style enforcement.
- **OpenFeign** - Declarative REST client.
- **OpenTelemetry** - Observability and distributed tracing.
- **JUnit 5** - Unit testing framework.
- **ArchUnit** - Architecture rule validation.
## Running the Application Locally
### Prerequisites
- **Java 21**
- **Gradle**
- **Docker & Docker Compose**
### Start Dependencies
Before running the application, start required dependencies using Docker Compose:
```sh
docker-compose up
```
This will create **PostgreSQL, MongoDB, Redis, RabbitMQ, and Jaeger** containers.
### Setting Up the Common Library Dependency
The **springboot-microservice-common-lib** dependency is not yet available in a central repository. To use it, you need to pull it from the GitHub package repository, which requires a **GPR_TOKEN**. Since this token is private and user-specific, it cannot be shared in this repository.
To include the dependency locally, follow these steps:
1. Clone the `springboot-microservice-common-lib` repository:
```sh
git clone https://github.com/mmushfiq/springboot-microservice-common-lib.git
```
2. Navigate to the cloned directory:
```sh
cd springboot-microservice-common-lib
```
3. Publish the library to your local Maven repository using Gradle:
```sh
./gradlew publishToMavenLocal
```
After completing these steps, the dependency will be available in your local Maven repository and can be used by this microservice.
### Running the Application
Run the application with the `local` profile. You can do this via IntelliJ IDEA run configurations or using the Gradle command:
```sh
./gradlew bootRun --args='--spring.profiles.active=local'
```
## API Documentation
Swagger UI is available at:
[http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html)
## Additional Tools
- **RabbitMQ UI** - Monitor queues:
[http://localhost:15672](http://localhost:15672)
- **Jaeger UI** - View tracing data:
[http://localhost:16686](http://localhost:16686)
## License
This project is licensed under the Apache-2.0 License.