Java SpringBoot方法的主体参数太多
我为呼叫我的RestApi创建了假客户机。当我尝试运行我的服务时,我收到来自此requestMethod的错误Java SpringBoot方法的主体参数太多,java,spring-boot,feign,Java,Spring Boot,Feign,我为呼叫我的RestApi创建了假客户机。当我尝试运行我的服务时,我收到来自此requestMethod的错误方法对于@RequestBody有太多的Body参数,我只使用了对象类型,因为每次我都可以发送另一个Body请求 @RequestMapping(path = "/v1/products/{product}/companies/{companyId}", method = RequestMethod.POST, consumes = "
方法对于@RequestBody有太多的Body参数
,我只使用了对象类型,因为每次我都可以发送另一个Body请求
@RequestMapping(path = "/v1/products/{product}/companies/{companyId}", method = RequestMethod.POST,
consumes = "application/json", produces = "application/json")
ResponseEntity<Object> createProduct(URI baseUri,
@HeaderParam("tenant-id") String tenantId,
@PathVariable("product") String product,
@PathVariable("companyId") String companyId,
@RequestBody Object reqBody);
@RequestMapping(path=“/v1/products/{product}/companys/{companyId}”,method=RequestMethod.POST,
consumes=“application/json”,products=“application/json”)
ResponseEntity createProduct(URI baseUri,
@HeaderParam(“租户id”)字符串tenantId,
@PathVariable(“产品”)字符串产品,
@PathVariable(“companyId”)字符串companyId,
@请求主体对象(请求主体);
您不能使用Object作为类型,请尝试使用我们的类指定。框架无法知道使用哪个实体作为响应
@RequestMapping(path = "/v1/products/{product}/companies/{companyId}", method = RequestMethod.POST,
consumes = "application/json", produces = "application/json")
ResponseEntity<MyEntity> createProduct(URI baseUri,
@HeaderParam("tenant-id") String tenantId,
@PathVariable("product") String product,
@PathVariable("companyId") String companyId,
@RequestBody Object reqBody);
@RequestMapping(path=“/v1/products/{product}/companys/{companyId}”,method=RequestMethod.POST,
consumes=“application/json”,products=“application/json”)
ResponseEntity createProduct(URI baseUri,
@HeaderParam(“租户id”)字符串tenantId,
@PathVariable(“产品”)字符串产品,
@PathVariable(“companyId”)字符串companyId,
@请求主体对象(请求主体);
您不能使用Object作为类型,请尝试使用我们的类指定。框架无法知道使用哪个实体作为响应
@RequestMapping(path = "/v1/products/{product}/companies/{companyId}", method = RequestMethod.POST,
consumes = "application/json", produces = "application/json")
ResponseEntity<MyEntity> createProduct(URI baseUri,
@HeaderParam("tenant-id") String tenantId,
@PathVariable("product") String product,
@PathVariable("companyId") String companyId,
@RequestBody Object reqBody);
@RequestMapping(path=“/v1/products/{product}/companys/{companyId}”,method=RequestMethod.POST,
consumes=“application/json”,products=“application/json”)
ResponseEntity createProduct(URI baseUri,
@HeaderParam(“租户id”)字符串tenantId,
@PathVariable(“产品”)字符串产品,
@PathVariable(“companyId”)字符串companyId,
@请求主体对象(请求主体);
您不能将对象
用作它需要的特定类型,否则序列化框架无法知道要使用哪个对象。您可以将requestbody作为字符串,然后根据需要进行解析。您还可以使用ObjectMapper将字符串映射到对象,根据条件,您不能使用对象
作为类型,它需要是特定类型,否则序列化框架无法知道要使用哪个对象。您可以将requestbody作为字符串,然后根据需要进行解析。您也可以使用ObjectMapper将字符串映射到对象,具体取决于条件