How use PUT method in Springboot Restcontroller?

前端 未结 5 1654
花落未央
花落未央 2021-02-09 14:37

Am developing an application using Spring boot.I tried with all representations verbs like GET, POST , DELETE all are working fine too. By using PUT method, it\'s not supporting

5条回答
  •  春和景丽
    2021-02-09 14:58

    Since Spring 4.3 you can use @PutMapping("url") : https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/bind/annotation/PutMapping.html

    In this case it will be:

    @PutMapping("/student/info")
    public @ResponseBody String updateStudent(@RequestParam(value = "stdName")String stdName){
        LOG.info(stdName);
        return "ok";
    }
    

提交回复
热议问题