Customize Spring @RequestParam Deserialization for Maps and/or Nested Objects
2015-11-16 11:31
751 查看
@RestController class MyController { @RequestMapping(...) public void test(Container container) { ... } }
Spring by default uses Dot-Notation to deserialize a nested @RequestParam:
class Container { A a; } class A { String val; }
works with:
http://.../myController?a.val=foo
But for Maps it uses Square Bracket notation:
class Container { Map<String, String> a; }
works with:
http://.../myController?a[val]=foo
When using JavaScript there's of course no difference between a HashMap and a Nested Object, so everything will get serialized either with Dots or Square-Brackets.
Question:
How / where can I tell Spring (or Spring Boot if that's easier) to use Dot-Notation (or Square Brackets) for both, nested objects and Maps?Or is there any reason why Spring makes a difference between those types?
相关文章推荐
- 第四章Object-C判断语句
- object-C方法调配
- Objective-C 程序设计 第十四章
- Objective-C 程序设计 第十三章
- Object类简介
- Objectiv-C学习笔记-如何关闭XCode ARC机制
- Using C++ With Objective-C
- iOS开发系列—Objective-C之Foundation框架
- Objective-c 手写控件
- Object-C 语法总结
- Objective-c(1)
- Objective-C中的instancetype和id区别
- 属性动画ObjectAnimator
- Objective-C:Foundation
- Objective-C:Foundation
- 思考中前进----泛型和Object比较
- Xamarin.iOS学习:使用Object Sharpie自动绑定Objective-C库
- object-c 中NSValue的解析
- 【ObjectC—浅copy和深copy】
- ECMAScript——引用数据类型之object