This repository provides a basic skeleton for building Java Spring-based microservices. It is designed to help you quickly bootstrap your microservice projects with commonly used configurations and practices.
- Spring Boot Framework: Built using Spring Boot for streamlined development.
- Dependency Management: Gradle for managing dependencies.
- Testing: Includes starter setup for unit and integration testing.
- Ready to use infrastructure: Contains Docker Compose setup with main and test dbs.
Ensure you have the following installed on your system:
- Java 21+
- Docker
git clone https://github.com/javaAndScriptDeveloper/spring-template
cd spring-templateBefore starting the application, ensure that the required databases are up and running. You can use the provided docker-compose.yml file to start the main and test databases.
Run the following command to start the databases:
docker-compose up -d main-db test-dbThis command starts the main database on port 5432 and the test database on port 5433. Ensure these services are running before starting the application.
- Open the project in your favorite IDE.
- Import the project as a Maven/Gradle project.
- Run the
Applicationclass from the IDE.
Build and run the application using Gradle:
./gradlew bootRunOr, if you're using Maven:
mvn spring-boot:runRun the unit and integration tests:
For Gradle:
./gradlew testFor Maven:
mvn testContributions are welcome! Please open an issue or create a pull request if you have ideas for improvements.
This project is licensed under the MIT License.
This template was inspired by best practices in Spring Boot microservice development.