Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 邮递员请求获取具有多个列表的查询<;字符串>;参数_Spring_Spring Mvc_Spring Data Jpa - Fatal编程技术网

Spring 邮递员请求获取具有多个列表的查询<;字符串>;参数

Spring 邮递员请求获取具有多个列表的查询<;字符串>;参数,spring,spring-mvc,spring-data-jpa,Spring,Spring Mvc,Spring Data Jpa,我正在尝试使用Postman测试多模块SpringWebMVCAPI端点。这是springmvcweb应用程序&也使用其他框架。 我想知道如何向这个URL发出请求 我的控制器文件如下所示 @Controller @RequestMapping(value = "/xyz") public class XyzWebController { @CrossOrigin(origins = "*") @RequestMapping(value = "", method = RequestMet

我正在尝试使用Postman测试多模块SpringWebMVCAPI端点。这是springmvcweb应用程序&也使用其他框架。 我想知道如何向这个URL发出请求

我的控制器文件如下所示

@Controller
@RequestMapping(value = "/xyz")
public class XyzWebController {

  @CrossOrigin(origins = "*")
  @RequestMapping(value = "", method = RequestMethod.GET)
  @ResponseBody
  public List<XyzChild> getProperties(@RequestParam XyzQueryDTO query) {
    return childService.getAll(query);
  }

...

}
public class XyzQueryDTO {

  List<String> properties;

  List<String> applications;


  public XyzQueryDTO() {
  }

  public XyzQueryDTO(List<String> properties, 
      List<String> applications) {
    super();
    this.properties = properties;
    this.applications = applications;
  }

...

}
@控制器
@请求映射(value=“/xyz”)
公共类XyzWebController{
@交叉原点(原点=“*”)
@RequestMapping(value=”“,method=RequestMethod.GET)
@应答器
公共列表getProperties(@RequestParam XYZQueryTo查询){
返回childService.getAll(查询);
}
...
}
XyzQueryDTO.java如下所示

@Controller
@RequestMapping(value = "/xyz")
public class XyzWebController {

  @CrossOrigin(origins = "*")
  @RequestMapping(value = "", method = RequestMethod.GET)
  @ResponseBody
  public List<XyzChild> getProperties(@RequestParam XyzQueryDTO query) {
    return childService.getAll(query);
  }

...

}
public class XyzQueryDTO {

  List<String> properties;

  List<String> applications;


  public XyzQueryDTO() {
  }

  public XyzQueryDTO(List<String> properties, 
      List<String> applications) {
    super();
    this.properties = properties;
    this.applications = applications;
  }

...

}
公共类XyzQueryDTO{
列出财产;
列出申请表;
公共XyzQueryDTO(){
}
公共XyzQueryDTO(列表属性,
(列出申请){
超级();
这个。属性=属性;
这是应用程序=应用程序;
}
...
}
请帮助我的网址,我可以用它来测试这个API


提前感谢。

使用
RequestMethod更简单、更正确。POST
而不是
RequestMethod。GET
@RequestBody
而不是
@RequestParam

@RequestMapping(value = "", method = RequestMethod.POST)
@ResponseBody
  public List<XyzChild> getProperties(@RequestBody XyzQueryDTO query) {
    return childService.getAll(query);
  }

在《邮递员》中,您可以在
正文中填写
XyzQueryDTO
作为
json

是的,我将进行更改,谢谢您的回答。