<aside> ☝🏻 개발환경과 배포환경을 나눈다
</aside>

app:
upload:
files:
target: s3
upload-url: /Users/nogihun/Desktop/joara-assets/upload-image
맥이라 로컬경로를 적어줌)<aside> ☝🏻 스프링 application.yml에 upload를 임포트 해준다.
</aside>
spring:
servlet:
multipart:
max-file-size: 50MB
max-request-size: 50MB
config:
import:
- classpath:/app/jwt/jwt.yml
- classpath:/app/cors/cors.yml
- classpath:/app/sample/sample-image.yml
- classpath:/app/sample/sample-image.yml 를 추가해주고
파일의 크기를 적용해준다.
<aside> ☝🏻 기존의 @Value 어노테이션 → 프로퍼티스 클레스를 만들어준다.
</aside>
package com.example.study.properties.upload;
import com.example.study.properties.upload.type.ImageStorageTargetType;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConfigurationPropertiesBinding;
@ConfigurationProperties(prefix = "app.upload.files")
@ConfigurationPropertiesBinding
public record UploadImageProperties(
ImageStorageTargetType target,
String uploadUrl
) {
public UploadImageProperties {
if (target == null) {
target = ImageStorageTargetType.LOCAL;
}
if (uploadUrl == null || "".equals(uploadUrl)) {
uploadUrl = "../upload";
}
}
}