springboot(2)-Http协议接口开发

  • @RestController and @RequestMapping是springMVC的注解,不是springboot特有的
  • @RestController = @Controller+@ResponseBody
  • @SpringBootApplication = @Configuration+@EnableAutoConfiguration+@ComponentScan​
  • @GetMapping(path = "/{city_id}/{user_id}")
    @PathVariable("city_id") String cityId,@PathVariable("user_id") String userId
  • @GetMapping(value="/v1/page_user2")
    @RequestParam(defaultValue="0",name="page",required = true) int from, int size
  • @RequestMapping("/v1/save_user")
    @RequestBody User user
  • @PostMapping("/v1/login")
  • @PutMapping("/v1/put")
  • @DeleteMapping("/v1/del")
    代码地址 https://github.com/mambamentality8/springboot
上一篇:SpringBoot——SpringBoot中的@RestController与@Controller


下一篇:AI临摹超漂亮的复古花纹文字