Reputation: 694
The use of Spring Data Rest is definitely a way to create applications really fast.
But keeping in mind the future production environment, I really want to know if it is a good idea to mix the endpoints in a @RestController (where you will call a service with business validations and logics) with query endpoints generated by the rest repositories.
Upvotes: 3
Views: 2000
Reputation: 4033
As it is based on the Hypermedia-Driven RESTful Web Service principle, it is great but depends on various use cases. Look for articles on Hypermedia-Driven RESTful Web Service and you will learn some good things also.
It is good - very good for insensitive data, which is generally available to all.
And quite good for data where you don't need any orchestration, as it would be direct from the db.
The only concern could be having them secured(the endpoints) under some super user type role in your application so that normal user(s) cannot access it.
It would again depend on the use case of your application.
If it is highly sensitive data, then it should not be used as data will available through the APIs and data would be compromised
Or having separate application which could reside in the premises of the application developing organisation only
Upvotes: 2
Reputation: 611
It should be good way to go ahead.
But as per my opinion, you should create separate controllers and services for different modules instead of putting all your REST API endpoints in one controller and creating only a single service.
By doing so, it would be easy for you to manage and debug your code in case of any issue is produced.
Upvotes: 0