private TestService testService;
@RequestMapping("/newUser/{name}")
@ResponseBody
public Object testNewUser(@PathVariable String name) {
User user;
try {
user = testService.findUser(name);
return "Existing User id: " + user.getId();
} catch (UserNotFoundException ex) {
}
user = new User();
user.setName(name);
testService.save(user);
return "New User id: " + user.getId();
}