springboot接口如下:
package com.hkj.springboot.apiForVue.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @author sunqi
* @description 测试接口
* @since 2021-02-19 11:25
*/
@RestController
@RequestMapping("/test")
public class TestParamController {
/**
* 测试get请求PathVariable传参
*/
@GetMapping("/getPathVariable/{username}/{pwd}")
public String testGetPathVariable(@PathVariable("username") String username, @PathVariable("pwd") String pwd) {
String result = username + " " + pwd;
System.out.println(result);
return result;
}
/**
* 测试get请求RequestParam传参
*/
@GetMapping("/getRequestParam")
public String testGetRequestParam(@RequestParam("username"<