0

I want to gather all params in my @RestController into a single bean for passing them downstream.

With Jersey I would define a @BeanParam, what seems not possible with Spring-Boot.

I tried defining a Parameterbean with accessors named like the @PathVariable, annotated the setters arguments with @PathVariable and the same for the constructor.

I found up to 5 years old examples on SO with @ModelAttribute I desperatly gave a try, with no success.

So is there something I could try?

sschrass
  • 7,014
  • 6
  • 43
  • 62

1 Answers1

0

I just fat fingered my param!

This answer works like charm for @PathVariable And QueryVariable. What one would have to do is just model an object with fields named after the params and use it without any annotations on the controller method.

But be aware that any param gets matched and therefore could be overridden. Also ControllerLinkBuilder (linkTo and methodOn) do not take the Parameters into account.

sschrass
  • 7,014
  • 6
  • 43
  • 62