Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
  • 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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Convert object before controller or in controller?  RSS feed

Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

My question is: Is it right to convert object before controller in http message converter OR I should do it in my controller calling specific converter manually.

I receive JSON from browser, in this format:

Before I get in controller I want to convert some properties, for example, from id to model [int groupId -> Group group].
So the final object will be like this:

And controller in this case is very small:

For such convertion, I created and registered CreateScheduleDTOConverter:

And in AppConfig that implements WebMvcConfigurer added:

A wop bop a lu bob a womp bam boom. Tutti frutti ad:
global solutions you can do at home or in your backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!