Skip to content

Instantly share code, notes, and snippets.

@Ikhiloya
Last active June 23, 2018 09:26
Show Gist options
  • Save Ikhiloya/dca029140269e93b5a62271ee550f756 to your computer and use it in GitHub Desktop.
Save Ikhiloya/dca029140269e93b5a62271ee550f756 to your computer and use it in GitHub Desktop.
controller class for spring-boot-jpa-oracle tutorial
@RestController
@RequestMapping("/user")
public class UserController {
@Autowired
UserService userService;
@RequestMapping(value = "/all", method = RequestMethod.GET)
public List<User> getAllUsers() {
return userService.getAllUsers();
}
@RequestMapping(value = "/adduser", method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody()
public User addNewUser(@RequestBody User user) {
return this.userService.addUser(user);
}
//other controllers omitted for brevity
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment