일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
- 애자일
- 안영미
- 박보영
- DI
- 디자인패턴
- 드온
- mssql
- 초감각
- 강유미
- jquery
- SaveFile
- 영어
- 드래곤볼 온라인
- 두뇌코칭
- 2011프로야구
- Oracle
- ajax
- 가톨릭
- Spring
- 십천2
- wbc
- MySQL
- bean
- G포인트
- 십이지천2
- 분장실의강선생님
- 파이썬
- annotation
- Sybase
- Spring4
- Today
- 16
- Total
- 508,224
행이네
파일 Upload 크기 제한 설정 본문
- 기본은 1MB
- multipart/form-data 로 받을 수 있는 것은 10MB
MultipartProperties (Spring Boot Docs 2.0.10.BUILD-SNAPSHOT API)
Properties to be used in configuring a MultipartConfigElement. location specifies the directory where uploaded files will be stored. When not specified, a temporary directory will be used. max-file-size specifies the maximum size permitted for uploaded fil
docs.spring.io
- src/main/resources/application.properties 에 아래 설정들로 조정할 수 있다.
- 기본
spring.servlet.multipart.max-file-size=128KB spring.servlet.multipart.max-request-size=128KB |
- multipart/form-data 로 받는
spring.http.multipart.max-file-size=128KB spring.http.multipart.max-request-size=128KB |
https://spring.io/guides/gs/uploading-files/
#Tuning file upload limits
하지만, Rest API로 만들고
Swagger로 Test하려할 때 multipart/form-data가 제대로 안되는 것 같을 때는
기본 설정을 추가해주면 Swagger에서도 Test가 잘 된다.
+ Swagger Tip 하나 더
@RequestBody가 아닌
@RequestPart xxxDto 로 정의한 경우
Swagger에서는 1개의 InputBox로만 표시되는데...
xxxDto의 모든 항목을 입력해야 할 때는
아래처럼 여러개의 값을 갖는 json 형태로 입력하면 Test할 수 있다.
{ "aaa": "111", "bbb": "222" } |
'plming > Java-Spring Boot' 카테고리의 다른 글
원인모를 LazyInitializationException - no Session (0) | 2020.05.25 |
---|---|
파일 Upload 크기 제한 설정 (0) | 2019.06.16 |
- Tag
- max-file-size, RequestPart, swagger