Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

spring boot rest controller, returning many objects/queries

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm writing my first spring boot/hibernate/jpa web app using rest controllers. I'm basically following along online resources such as
this tutorial

My question is, using that particular tutorial as an example, in a case where I make a rest call to the controller:



but in addition to the list of notes that that function returns, I also want a list of most recent comments, recently viewed notes, maybe update some info re: the users status....how do I combine all that info?

Do I use a master controller that has multiple @Auitowired repositories?

thanks!
 
Rancher
Posts: 527
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are doing a simple project that you will not require maintenance then you could put all of those in a 'master' controller if you want.  It isn't a good design though. if you put logic combining that data into the controller, then what if you want to get the combined data in another controller or another service?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic