This is a project that takes care of the management of books and loans in a library using the TDD (Test Driven Development) technique. Uses Java 17 and Spring Boot 3.1.3 and PostgreSQL as database despite using the H2 database due to TravisCI
- Clone the repository:
git clone https://github.com/DouglasLiebl/Library-API.git-
Install dependencies with Maven
-
(Optional) This project is using H2 database but you can change it. Install PostgreSQL and put those lines on application.yaml:
jpa:
database: postgresql
hibernate:
ddl-auto: update
show-sql: true
properties:
hibernate:
jdbc:
lab:
non_contextual_creation: true
generate-ddl: true
datasource:
url: jdbc:postgresql://localhost:5432/ # Your database name
username: # Your postgres username
password: # Your postgres password
driver-class-name: org.postgresql.Driver- Just start the application.
- (Using PostgreSQL) Make sure your PostgreSQL is running on your machine.
- Open the command prompt in the project folder and type the commands bellow:
docker build -t preferred-name-for-image .then
docker run --name name-for-conteiner -p 8080:8080 image-name- If you wanna use PostgreSQL put this different part on your application.yaml:
datasource:
url: jdbc:postgresql://postgresql:5432/library-apiand type this command:
docker compose up --build