From 2b698945ca07d32bbcdacb0c66140a338b25377a Mon Sep 17 00:00:00 2001 From: firefox1234123 Date: Thu, 1 Aug 2024 23:33:03 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=97=85=EB=A1=9C=EB=93=9C#7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../likelion12thteam03be/post/application/PostService.java | 3 ++- src/main/resources/application.yml | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/skhu/likelion12thteam03be/post/application/PostService.java b/src/main/java/net/skhu/likelion12thteam03be/post/application/PostService.java index 99a0bc2..f7ff20b 100644 --- a/src/main/java/net/skhu/likelion12thteam03be/post/application/PostService.java +++ b/src/main/java/net/skhu/likelion12thteam03be/post/application/PostService.java @@ -18,6 +18,7 @@ import net.skhu.likelion12thteam03be.user.domain.repository.UserRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; @@ -37,7 +38,7 @@ public class PostService { private final UserRepository userRepository; @Transactional - public void postSave(PostSaveReqDto postSaveReqDto, MultipartFile multipartFile, Principal principal) throws IOException { + public void postSave(PostSaveReqDto postSaveReqDto, @RequestPart(required = false) MultipartFile multipartFile, Principal principal) throws IOException { String imgUrl = s3Service.upload(multipartFile, "post"); String loginId = principal.getName(); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index d0925c2..2c6e16c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -6,6 +6,10 @@ spring: username: ${spring.datasource.username} password: ${spring.datasource.password} driver-class-name: com.mysql.cj.jdbc.Driver + servlet: + multipart: + maxFileSize: 10MB # 파일 하나의 최대 크기 + maxRequestSize: 30MB # 한 번에 최대 업로드 가능 용량 jpa: database: mysql hibernate: