Java application, using Spring as a framework and Maven as a package manager in building a backend with Rest architecture, Clean Code and S.O.L.I.D in a simple Java Certifications API
br.com.pratesmath.java-certifications-apiRun application
mvn spring-boot:run- Lombok: It is a Java lib that simplifies Spring Boot development, eliminating the need to write boilerplate code, such as getters, setters and constructors, making the code more concise and readable;
- H2 (Database Engine): It is an in-memory database (does not require installation or configuration, and obviously cannot be used in production) that is used for development and testing in Spring Boot projects;
- It is a Spring Data JPA project that simplifies interaction with relational databases, allowing CRUD operations in an easier and more efficient way, using the ORM concept. NOTE: uses Hibernate underneath (the most well-known Java ORM);
- An ORM (Object-Relational Mapping) is used to map objects in a software system to tables in a relational database. This facilitates data manipulation and abstracts SQL complexities, making development more efficient and less prone to errors;
Integration with H2 Database
Add the following dependencies to the project'spom.xml:
<dependencies>
<!-- add the dependencies bellow: -->
</dependencies>Add the following changes to: src/resources/application.properties
# change default port:
server.port=8085
# database:
spring.datasource.url=jdbc:postgresql://localhost:5434/java_certifications_api
spring.datasource.password=docker
spring.datasource.username=docker
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=trueAPI Rest
- GET: search a resource
- POST: insert a resource
- PUT: update a resource
- DELETE: remove a resource
- PATCH: update a single info in a resource (ex.: change user password)
Types of params
- body: request body (ex.: signup user form)
- query params: these are one or more queries into a request params(ex.: https://site.com/users?name=matheus&age=20, they are optional)
- route params: similar to query params, but they're separated by a "/" (ex.: https://site.com/users/{name}/{age})
Made w/ 💙 by pratesMath.
