我试图将UUID用作请求参数之一。这导致异常,NoSuchMethodException:java.util.UUID 采取的步骤:
如何让spring自动从字符串创建UUID并获取UUID对象而不必手动扩展StdDeserializer?是否有任何注释?
@RequestMapping(value = "/users", method = {RequestMethod.GET})
@ResponseBody
public User getUserByID(String id) {
UUID uuid = UUID.fromString(id); // explicit conversion
return usersManager.getUserByID(uuid);
}
@RequestMapping(value = "/users", method = {RequestMethod.GET})
@ResponseBody
public User getUserByID(UUID id) {
return usersManager.getUserByID(id);
}