USE test
DROPTABLEIFEXISTS tbl_user;CREATETABLE tbl_user(
id INT(10)AUTO_INCREMENTPRIMARYKEY,
last_name VARCHAR(50),
email VARCHAR(50));
controller
import org.springframework.beans.factory.annotation.Autowired;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.PathVariable;import org.springframework.web.bind.annotation.RestController;@RestControllerpublicclassUserController{@Autowired
UserRepository userRepository;@GetMapping("/user/{id}")public User getUser(@PathVariable("id") Integer id){
User user = userRepository.findOne(id);return user;}@GetMapping("/user")public User insertUser(User user){
user.setLastName("abc");
user.setEmail("213213@eml.com");
User save = userRepository.save(user);return save;}}