Last active
June 23, 2018 09:26
-
-
Save Ikhiloya/dca029140269e93b5a62271ee550f756 to your computer and use it in GitHub Desktop.
controller class for spring-boot-jpa-oracle tutorial
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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