This repository is a copy (with some changes) of the repository workshop-springboot3-jpa by acenelio made in his course Java COMPLETO 2023 Programação Orientada a Objetos +Projetos.
- Java 8 or higher
- PostgreSQL
-
In
src/main/resources/application.properties, the default profile istestwhich will use the in-memory H2 database. To view the database, run the API, and type the URL in your browser:localhost:8080/h2-console.spring.profiles.active=test
-
If you want to use PostgreSQL, switch the profile to
devand make the following settings:spring.profiles.active=dev
-
open
application-dev.properties; -
Create a database with the name of your preference in postgresql, and insert its URL:
spring.datasource.url=jdbc:postgresql://localhost:5432/springboot_course
-
Enter your username:
spring.datasource.username=postgres
-
Enter your password:
spring.datasource.password=1234567
-
GET users: returns a list of all users. -
GET users/{id}: returns a user by id. -
POST users: Registers a user. -
DELETE users/{id}: Deletes a user by id. -
PUT users/{id}: Updates the data of a user by id.
-
GET categories: returns a list of all categories. -
GET categories/{id}: returns a category by id. -
POST categories: Registers a category. -
DELETE categories/{id}: Deletes a category by id. -
PUT categories/{id}: Updates the data of a category by id.















