이미지 첨부가 가능한 게시글, 게시판을 만들면서 정리하는 내용이다.
Spring Boot + Gradle + JPA로 구현했다.
application.yml 설정
servlet:
multipart:
enabled: true
location: //저장하고 싶은 위치
max-request-size: 30MB
max-file-size: 10MB
enabled : 파일 업로드 가능 여부
location :업로드된 파일의 임시 저장 경로
max-request-size :한 번에 최대 업로드 가능 용량
max-file-size :파일 하나의 최대 크기
Entity [BOARD, IMAGES]
Controller
Service
Postman Test
File
![](https://t1.daumcdn.net/keditor/emoticon/friends1/large/019.gif)
https://winter1396love.tistory.com/72
RequestBody, RequestPart, RequestParam, ModelAttribute
RequestPart, Body를 위해서 한번 더 정리한다. RequestBody Http 요청은 body가 그대로 넘어온다. 이 body 내용을 HttpMessageConverter로 보내거 자바 객체로 변환하여 메소드 파라미터로 전달해준다. Http 요청으
winter1396love.tistory.com
https://winter1396love.tistory.com/73
[Spring] consumes 사용하기
프로젝트를 진행하면서 JSON 데이터와 MultipartFile을 한번에 저장하고 싶어 적용해보았다. 우선 consumes는 @RequestMapping의 수신, 출력하고자 하는 데이터 포맷을 정의할 수 있다. JSON, MultiPartFile을 한
winter1396love.tistory.com
'개발 > Spring' 카테고리의 다른 글
Spring Boot + Spring Security + H2 DataBase 써보기 (0) | 2022.12.19 |
---|---|
Spring Security인 액션[ING] (0) | 2022.12.14 |
[Spring] consumes 사용하기 (0) | 2022.11.22 |
RequestBody, RequestPart, RequestParam, ModelAttribute (0) | 2022.11.22 |
[Spring] RequestContextHolder - 정리 (0) | 2022.07.20 |