问题描述:
提供给外部三方的一个jar中,通过springboot框架暴露了一个application/x-www-form-urlencoded 类型的http接口。其中入参有一个大的字符串属性doc。偶发出现一个问题,某一个请求报错
WARN 27139 --- [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.bind.MissingServletRequestParameterException: Required String parameter 'doc' is not present]
实际外部请求时,doc参数是有值的。
问题原因:
Springboot默认的application/x-www-form-urlencoded 类型的http接口参数的大小是2M。报错的那笔请求参数的大小已经超过2M了。
解决方案:
在Springboot的配置文件中加上下面的配置(表示不限制大小)
server.tomcat.max-http-form-post-size=-1