Caused by: java.lang.IllegalStateException: Method has too many Body parameters
feign多参数问题
1.1GET方式
错误写法
@RequestMapping(value="/test", method=RequestMethod.GET)
Model test(final String name, final int age);
启动服务的时候,会报如下异常:
Caused by: java.lang.IllegalStateException: Method has too many Body parameters: public abstract com.chhliu.springboot.restful.vo.User com.chhliu.springboot.restful.feignclient.UserFeignClient.findByUsername(java.lang.String,java.lang.String)
异常原因:当使用Feign时,如果发送的是get请求,那么需要在请求参数前加上@RequestParam注解修饰,Controller里面可以不加该注解修饰。
正确写法
@RequestMapping(value="/test", method=RequestMethod.GET)
Model test(@RequestParam("name") final String name,@RequestParam("age") final int age);
1.1POST方式
错误写法
public int save(@RequestBody final Person p, @RequestBody final UserModel user);
feign中你可以有多个@RequestParam,但只能有不超过一个@RequestBody。
正确写法
public int save(@RequestBody final Person p,@RequestParam("userId") String userId,@RequestParam("userTel") String userTel);
转自:https://www.cnblogs.com/chenkeyu/p/8482276.html
Caused by: java.lang.IllegalStateException: Method has too many Body parameters的更多相关文章
- 【异常】Caused by: java.lang.IllegalStateException: Method has too many Body parameters
出现此异常原因是引文使用feign客户端的时候,参数没有用注解修饰 1.1GET方式错误写法 @RequestMapping(value="/test", method=Reque ...
- Feign调用远程服务报错:Caused by: java.lang.IllegalStateException: Method getMemberInfo not annotated with HTTP method type (ex. GET, POST)
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ord ...
- Caused by:java.lang.IllegalStateException at android.media.MediaPlayer._setDataSource(Native Method)
使用Mediaplayer播放本地音频,在第二次调用mediaplayer.setDataSource()时报错如下: Caused by: java.lang.IllegalStateExcepti ...
- 【spring boot】【elasticsearch】spring boot整合elasticsearch,启动报错Caused by: java.lang.IllegalStateException: availableProcessors is already set to [8], rejecting [8
spring boot整合elasticsearch, 启动报错: Caused by: java.lang.IllegalStateException: availableProcessors ], ...
- Caused by: java.lang.IllegalStateException: javax.websocket.server.ServerContainer not available
java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.co ...
- Caused by: java.lang.IllegalStateException: Ambiguous mapping found
Caused by: java.lang.IllegalStateException: Ambiguous mapping found. Cannot map ‘myCockpitMgrControl ...
- Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError
SLF4J: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackO ...
- Caused by: java.lang.IllegalStateException: Expected raw type form of org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$Match
spring 4.0.2,mybatis 3.2.6,aspectjweaver 1.8.10 使用的时候,报错: Caused by: java.lang.IllegalStateException ...
- Caused by java.lang.IllegalStateException Not allowed to start service Intent { cmp=com.x.x.x/.x.x.xService }: app is in background uid UidRecord(一)
Caused by java.lang.IllegalStateException Not allowed to start service Intent { cmp=com.x.x.x/.x.x.x ...
随机推荐
- Oracle 12C -- clone a remote pdb
Connect to the remote CDB and prepare the remote PDB for cloning. SQL> select con_id,dbid,name,op ...
- Innodb中自增长值的列
Innodb中,自增长值的列必须是索引,同时必须是索引的第一个列.如果不是第一个列,数据库会报出异常 mysql> create table t_inc01( -> a int auto_ ...
- MySQL-慢查询日志
慢查询日志功能默认不开启,其记录了执行时间超过参数long_query_time的值(默认是10),且访问的行数超过了参数min_examined_row_limit的值得SQL语句. mysql&g ...
- SharePoint 2013 启用 查看PDF功能
SharePoint 2013 默认不能直接Online (注:此Online非OWA概念,而是可以实现直接调用客户端软件实现对文档的编辑,保存之后同步上传)打开PDF(SharePoint 2013 ...
- 验证码识别 图像降噪 Python (一)
原始图片: 降噪后的图片 实现代码: # coding:utf-8 import sys, os from PIL import Image, ImageDraw # 二值数组 t2val = {} ...
- FIR调用DSP48E_05
作者:桂. 时间:2018-02-06 17:52:38 链接:http://www.cnblogs.com/xingshansi/p/8423457.html 前言 到目前为止,本文没有对滤波器实 ...
- Oracle多表关联如何更新多个字段
注意点:1.被update主表一定要加上过滤条件.2.查询出来更新结果集,同时也要作为被更新主表的条件,作为同步大家都是更新这部分数据.update student stu set (stu.name ...
- Unity GPU Instancing的使用尝试
似乎是在Unity5.4中开始支持GPU Instacing,但如果要比较好的使用推荐用unity5.6版本,因为这几个版本一直在改. 这里测试也是使用unity5.6.2进行测试 在5.6的版本里, ...
- ubuntu for win10 里运行net core
花了点时间在ubuntu for win10里运行net core 按官网上ubuntun10.14装的net core指令 ...... ...... sudo apt-get install do ...
- lua -- table.nums
table.nums 计算表格包含的字段数量. 格式: count = table.nums(表格对象) Lua 的“#”操作可以取得表格的长度,但仅限从 开始连续数字为索引的表格.table.num ...