我的控制器中有方法:
@RequestMapping(method = RequestMethod.POST)
public CustomObject createCustomObject(final @RequestHeader("userId") Long userId) {
...
}
Run Code Online (Sandbox Code Playgroud)
我可以编写一些自定义转换器或类似的东西来将此RequestHeader userId参数转换为User对象,因此我的方法将是:
@RequestMapping(method = RequestMethod.POST)
public CustomObject createCustomObject(final User user) {
...
}
Run Code Online (Sandbox Code Playgroud)
是否可以使用spring-mvc?