Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring : Auto Generate CRUD Rest Controller

Is there a way to generate spring rest crontroller for a business flow.
I want to generate CRUD services for given database object.
For example, "employee_mst" , generate CRUD services code automatically.
This is similar to what we used to have in hibernate or what we have in loopback.io for node.
Appreciate any help around it.

like image 293
Allzhere Avatar asked Sep 19 '17 11:09

Allzhere


1 Answers

I found a link that may answer your question: https://docs.spring.io/spring-data/rest/docs/current/reference/html/.

This text explains that Spring Data REST generates REST interfaces from Spring Data repositories.

I intend to try this but did not do so yet.

EDIT: I saw in my example application that Spring Data REST did what I expected. I could request all entities in my Spring Data repository using a HTTP request. The returned JSON contained also discovery information. You may prefer writing your own controller to have more control on what information is returned.

like image 142
Martijn Dirkse Avatar answered Nov 15 '22 10:11

Martijn Dirkse