Allzhere
Allzhere

Reputation: 1360

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.

Upvotes: 7

Views: 8039

Answers (1)

Martijn Dirkse
Martijn Dirkse

Reputation: 667

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.

Upvotes: 6

Related Questions