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-template
Before 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-db
This 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
Application
class from the IDE.
Build and run the application using Gradle:
./gradlew bootRun
Or, if you're using Maven:
mvn spring-boot:run
Run the unit and integration tests:
For Gradle:
./gradlew test
For Maven:
mvn test
Contributions 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.