博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
spring boot 设置tomcat post参数大小限制修改
阅读量:2433 次
发布时间:2019-05-10

本文共 1082 字,大约阅读时间需要 3 分钟。

SpringBoot项目上使用富文本框,如果图片很多的话,会报如下错误:

2020-09-28 14:26:59.568 ERROR 8 --- [nio-8098-exec-5] Servlet.service() for servlet [dispatcherServlet] in context with path [/product-manage] threw exception [Request processing failed; nested exception is org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.lang.IllegalStateException: The multi-part request contained parameter data (excluding uploaded files) that exceeded the limit for maxPostSize set on the associated connector] with root causejava.lang.IllegalStateException: The multi-part request contained parameter data (excluding uploaded files) that exceeded the limit for maxPostSize set on the associated connector

这个是字符串接收,不是文件接收,请求方式是post,post本身没有参数大小限制,但是tomcat给限制了,于是解决方式如下:

一、外置的tomcat

这个简单,直接在server.xml里面添加或者修改这句话:

修改这里的maxPostSize的值,默认是1024,改成0,就可以不限制了大小了

二、使用spring boot自带的tomcat

那就在application.properties中加上这句话:

server.tomcat.max-http-post-size=0

如果是SpringBoot 2.x版本加这句话:

server.tomcat.max-http-post-size=-1

修改了配置之后记得重启服务器,做了热部署的伙伴,如果无效,记得重启一下再测试。

转载地址:http://gwamb.baihongyu.com/

你可能感兴趣的文章
链表算法面试题---合并N个有序链表
查看>>
链表算法面试题---分割链表
查看>>
总结、归类---使用二分处理旋转数组的问题
查看>>
分布式常用技术
查看>>
uniapp DES加解密
查看>>
小程序DES加解密
查看>>
Vue 路由 导航守卫(全局守卫、路由独享守卫)
查看>>
ajax图片上传
查看>>
小程序数组去重
查看>>
微信小程序生成分享海报
查看>>
值得收藏的 CSS 形状
查看>>
H5屏幕宽度大小自适应方式
查看>>
中秋诗歌两首
查看>>
计算机学科一些重要算法的列表
查看>>
进站画面:1q84音乐电台
查看>>
回复旦
查看>>
二十世纪计算机十大著名算法
查看>>
MFC程序更换XP皮肤
查看>>
SkinSharp使用方法
查看>>
盘点2010年电子书市场
查看>>