工具官网:https://www.apipost.cn/ 适用人群如下:
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
DemoController de = new DemoController();
}
@RequestMapping("demo")
@RestController
class DemoController{
@GetMapping("method1")
public String method1(){
return "hello springboot";
}
@GetMapping("method2")
public String method2(@RequestParam("a")String a)
{
return "hello springboot:"+a;
}
@GetMapping("method3")
public String method3(@RequestParam("a")Integer a,@RequestParam("b")Integer b)
{
return "hello springboot:" +(a+b);
}
@GetMapping("method4/{c}")
public String method4(@PathVariable("c")String c)
{
return "hello springboot"+c;
}
@PostMapping("method5")
public void method5(Map map){
for(Object o :map.keySet())
{
System.out.println(o+"-->"+map.get(o));
}
}
}