Skip to content

Chillaso/poc-spring-data-rest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PoC: Spring Data REST

This project is a proof of concept for the Spring Data REST library.

Description

The project uses Spring Data REST to expose JPA entities as REST services. The main entities and repositories included in the project are:

  • Entities:

    • Author: Represents an author.
    • Book: Represents a book.
    • AuthorBook: Represents the relationship between an author and a book.
    • Flow and Node: Represent flows and nodes, respectively.
  • Repositories:

Additionally, the project includes an EventHandler that handles specific events related to the entities.

Advantages of Spring Data REST

Spring Data REST builds on top of Spring Data and Spring MVC to provide an easy way to expose JPA repositories as REST services. Here are some of the advantages of using Spring Data REST compared to just Spring Data MVC and JPA:

  1. Automation: Spring Data REST automates the creation of REST endpoints for entities, eliminating the need to write custom controllers for each CRUD operation.

  2. HATEOAS: Provides built-in support for HATEOAS (Hypermedia as the Engine of Application State), facilitating navigation and discovery of related resources.

  3. Customization: While Spring Data REST automates many tasks, it also offers extension points to customize business logic, validations, and events.

  4. Integration with Spring Security: It integrates easily with Spring Security to provide authentication and authorization at the endpoint level.

  5. Validation: Allows automatic validation of entities before persisting them, using Java Bean validation annotations.

  6. Pagination and sorting: Offers built-in support for pagination and sorting of results, without the need to implement additional logic.

  7. Less code: By automating the creation of endpoints and other functionalities, the amount of code required to expose entities as REST services is significantly reduced.

Configuration

The project is set up to run on port 8082 and uses an in-memory H2 database. You can review the configuration in the application.yaml file.

Execution

To run the project, simply run the main class SpringDataRestApplication.

Generated by ChatGPT

About

Proof of concept of Spring Data REST using HAL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages