• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Exposing controller and services as REST API

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Suggestion from a spring expert saying that we should expose both

1. Controller and Service class as REST APIs
2. When a user sends a request, the controller receives the request. Later the controller should invoke a REST API call to the service method

He said this is the latest design and it has lots of advantages on the same.

a. Is this is the right way ?
b. What does this design is being called ?
c. Advantages and dis-advantages of the above.

Thanks.
 
Rancher
Posts: 500
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure if what you said is correct, because if you want to expose a service via REST with spring, you are going to use a controller.  What he might be saying is that you make a basic REST api to get only the minimum data from the service, and for the 'controller' you might have something more complicated that involves multiple services.
What are you trying to do?
 
Al Hobbs
Rancher
Posts: 500
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually making a call to a rest api in a controller seems a bit insane.  Correct me if I'm wrong, but the only reason I can think of doing that is if you don't have direct access to a service.  I think maybe you misunderstood what the guy was telling you.
 
Uh oh, we're definitely being carded. Here, show him this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!