Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference for spring-boot-starter-web and spring-boot-starter-data-rest for REST APIs [closed]

I'm trying to figure out the best practise in Spring to develop a REST API.

I found those two packages and as far as I understand the difference between them is:

  • web supports other things on top of REST API
  • web manages resource access via controllers
  • data-rest manages resource access via the repository

Is there anything that I'm missing? Most examples are on top of web so I wonder what decisions points would lead me to favor one over the other in my app.

like image 754
shredding Avatar asked Feb 21 '18 20:02

shredding


People also ask

What is the difference between spring boot starter and spring boot starter web?

Difference Between Spring Boot Starter Web and Spring Boot Starter Tomcat. Spring Boot Starter Web is used for building RESTful applications using Spring MVC. Spring Boot Starter Tomcat is the default embedded container for Spring Boot Starter Web. We cannot exclude it while using web services.

What is the use of spring boot starter data REST?

Spring Data REST builds on top of Spring Data repositories, analyzes your application's domain model and exposes hypermedia-driven HTTP resources for aggregates contained in the model.

What is spring boot and REST API?

Spring Boot is a Java framework, built on top of the Spring, used for developing web applications. It allows you to create REST APIs with minimal configurations. A few benefits of using Spring Boot for your REST APIs include: No requirement for complex XML configurations.

What is spring boot starter data JDBC?

Spring Data JDBC is a persistence framework that is not as complex as Spring Data JPA. It doesn't provide cache, lazy loading, write-behind, or many other features of JPA.


1 Answers

Well it depends on what you want. Both are -web- starters (they make easy to add jars to your classpath) that will help you make a REST API, but data-rest has a more specific purpose, it help you to expose repositories as a REST services (In fact if you see their pom.xml, data-rest depends on stater-web). If that is what you want, voila! But if you want more control over the data, controllers, validation or project structure, stater-web is your option.

like image 62
evdelacruz Avatar answered Oct 20 '22 00:10

evdelacruz