Spring data versus spring jpa data

I reviewed the following question

What are the benefits of using Spring Data REST over Spring JPA data?

It doesn’t quite satisfy my needs. My database is located on MYSQL, I chose the Spring -Data-JPA implementation. What are all the additional benefits that REST can give that I cannot find in a simple Spring-Data-JPA? For example, if tomorrow, I decided to implement the b / w cache of my business and the database module, in which case would I have to write less code? What would be easy to set up? What would be more flexible and how?

Also, if I use both REST and JPA in a new application, what development principles do I violate?

I look forward to receiving answers in terms of architecture. Thanks in advance.

+8
spring-data-jpa spring-data-rest architecture
source share
1 answer

Basically, I think your question is not entirely relevant. I think that you did not find your way through the jungle of the spring project, so I try to give a little orientation here.

Spring -data-jpa is a spring way to access data using JPA. You can use spring-data-rest on top of spring-data-jpa to create a REST-API layer without code on top of your repositories and entities.

And what spring-data-rest can do for you is just awesome. This is the fastest way to create a REST API on top of your JPA. And it is also very customizable. But I think this has limitations. The most significant weakness is the tight connection between objects and the API. Usually you want to untie these layers a bit. But this is a great program. If you need to be fast and want to write a minimal amount of code, go for spring data.

A spring alternative spring -data-rest uses spring MVC directly to create the REST API on its own, spring -data-jpa will still be used to implement the data access layer. spring MVC is very powerful and is used by spring-data-rest under the hood. This gives you complete control over the REST level.

I also want to mention spring HATEOAS - it's just a module on top of spring mvc, and it provides you with tools for creating a REST API with hypermedia support, so you can go to the maturity level Richardson Maturity Model - it also uses spring-data-rest internally.

+17
source share

All Articles