#SpringBoot# SpringBoot接口Http协议开发

SpringBoot2.xHTTP请求配置

SpringBoot2.xHTTP请求注解讲解和简化注解配置

  • @RestController and @RequestMapping是springMVC的注解,不是springboot特有的
  • @RestController = @Controller+@ResponseBody
  • @SpringBootApplication = @Configuration+@EnableAutoConfiguration+@ComponentScan ​localhost:8080

开发必备工具PostMan接口工具

模拟Http接口测试工具PostMan

  • 接口调试工具安装和基本使用
  • 下载地址:https://www.getpostman.com/

SpringBoot基础HTTP接口GET请求

springboot接口,http的get请求,各个注解使用
1、单一参数@RequestMapping(path = “/{id}”, method = RequestMethod.GET)

  • public String getUser(@PathVariable String id ) {}
  • @RequestMapping(path = “/{depid}/{userid}”, method = RequestMethod.GET) 可以同时指定多个提交方法 getUser(@PathVariable(“depid”) String departmentID,@PathV

你可能感兴趣的:(springboot)