java - Spring Webflux - 文件上传大小限制(spring.servlet.multipart.max-file-size 不起作用)
问题描述
有文件上传大小FilePart
吗?这不起作用:我将其设置为 100B,但我可以上传 8KB 的文件。
spring:
servlet.multipart: # see MultipartProperties
max-file-size: 100B
max-request-size: 200B
我知道这是针对多部分的,但我使用的是 FilePart:
@PostMapping(value = "/{id}/draft/target", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(OK)
public Mono<TargetsValidationResponse> uploadTargets(@PathVariable("id") ObjectId id, @RequestPart(name = "file") Mono<FilePart> file) {
return file.flatMap(parser::parseTargets)
.zipWith(promotionServiceAdapter.getDraft(id))
...;
}
解决方案
推荐阅读
- javascript - MongoDB 函数未按预期返回
- linux - 如何处理 http 客户端的最大连接数问题?
- java - 在 android - java 中使用 mbtiles 文件或 sqlitedb 文件制作地图
- asp.net-mvc - 如何在 ADFS 2018 中配置注销后重定向 uri?
- flutter - Flutter web:svg上未处理的元素过滤器
- autodesk-forge - Autodesk-designautomation:内部服务器错误(错误代码 500):WorkItem 中缺少参数
- html - float 属性在块元素上的行为如何
- java - 如何在我的应用程序中使用 Explain 找到 Mysql 查询的缓慢性?
- python-3.x - 在使用唯一路径算法记忆我的结果时,我做错了什么吗?
- python - 如何在决策树分类器中解释标签编码的分类特征?