This repository contains a Spring API (Spring Boot v3) that provides a simple manipulation of a database of products.
- Java Development Kit (JDK) 17
- Maven
- Docker
git clone https://github.com/yliborio/demo-spring-app
Navigate to the docker directory:
cd docker
Build the Docker image for PostgreSQL with the desired tag name (e.g., postgres-spring-api):
docker build -t postgres-spring-api .
Run the PostgreSQL container:
docker run -d -p 5432:5432 --name postgres-spring-api
You can replace the credentials with your desired PostgreSQL password in the Dockerfile.
The PostgreSQL database will be accessible at localhost:5432. Now we can connect the database with the Spring API.
Navigate to the project directory and build the project using Maven or via IDE:
mvn clean install
Run the application:
mvn spring-boot:run
The API will be accessible at http://localhost:8080.
For API documentation and usage, access the Swagger UI at http://localhost:8080/swagger-ui/index.html.