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

shredding :

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.

evdelacruz :

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.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=435930&siteId=1