与 Spring Data JPA 相比,使用 Spring Data REST 有哪些优势? [英] What are the advantages of using Spring Data REST over Spring Data JPA?
问题描述
我知道 spring data rest 会将您的存储库导出为 REST 服务..但我想知道与使用 spring data jpa 相比的优势.
I know that spring data rest will export your repositories as REST services..but i want to know advantages of that over use of spring data jpa.
推荐答案
这是水果沙拉与自助餐的比较,因为这些技术解决了完全不同的问题:
This is a fruit-salad-to-buffet comparison as the technologies solve completely different problems:
Spring Data JPA 简化了在 Spring 之上使用 JPA 的过程.它公开了一个存储库编程模型,允许您构建 Java API 来访问关系数据库中的数据.
Spring Data JPA eases working with JPA on top of Spring. It exposes a repository programming model which allows you to build Java APIs to access data in relational databases.
Spring Data REST 构建在存储库抽象之上(不依赖于JPA)并通过 HTTP 公开遵循通用模式的基于 Spring MVC 的 REST 资源.
Spring Data REST builds on top of the repository abstraction (not being tied to JPA at all) and exposes Spring MVC based REST resources following common patterns via a HTTP.
我建议浏览入门 Spring Data JPA 指南和 Spring Data REST 一起玩,感受一下他们解决的问题.
I suggest to skim through the getting started guides for Spring Data JPA and Spring Data REST to play with both of them and get a feel for the problems they solve.
这篇关于与 Spring Data JPA 相比,使用 Spring Data REST 有哪些优势?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!