My requests look like:
http://...
?type[A].size=14
&type[B].query=test
My @Controller
has a method which should accept those generic request params:
@RequestMapping(...)
public void test(MyModel m) {
...
}
public static class MyModel {
Map<String, ?> type;
}
The problem is: ?
should be some class which is defined by the key of the Map
.
This means: key=A
should Map to class A
and key=B
should map to class B
. According to the given request above: Class A
will have a property int size
and class B
will have a property String query
.
I just can't figure out, how I can tell Spring to use class A
for key A
and class B
for key B
.
(I know I could do it with POST
and Jackson, but I'd like to solve this using a GET
request).
Thanks for your help :)