Springboot 发送一个get请求

在这样一个代码块中,很清晰的看到在@RequestMapping中声明了请求方法为GET,在@RequestParam(value=”userName”)中可以看到,我们把请求参数的名字设置为userName

@RestController
public class HelloController {

@RequestMapping(value="/hello",method= RequestMethod.GET)
    public String hello(@RequestParam(value="userName")String userName){
        return "Hello "+userName;
    }
}

效果图

Springboot 发送一个get请求_第1张图片

你可能感兴趣的:(Springboot 发送一个get请求)