package com.xbhong.Controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@RestController
public class myContro {
@RequestMapping(value = “/user”,method = RequestMethod.GET)
public String getUser(){
return “GET-张三”;
}
// @PostMapping("/user")
@RequestMapping(value = “/user”,method = RequestMethod.POST)
public String saveUser(){
return “POST-张三”;
}
@RequestMapping(value = “/user”,method = RequestMethod.PUT)
public String putUser(){
return “PUT-张三”;
}
@RequestMapping(value = “/user”,method = RequestMethod.DELETE)
public String deleteUser(){
return “DELETE-张三”;
}
}
测试功能是否可用:
=========
观察效果