As we are using dependency injection in spring for dynamically instantiate and use dependencies, I would like to know if there any similar practice to handle input for consumer of any message broker or even REST end point.
As I know, we can provide our POJO as the input type with suitable annotation(@RequestBody) and framewordk will use available marshalling library to convert incoming json to an instance of POJO.
If we have to change the structure of incoming JSON, i think like adding an adapter in front of this which convert new JSON to what our method expects.
I would like to know if there any better approach to handle this utlizing some spring framework offerings. Any feature similar to DI there to achieve this?