File tree Expand file tree Collapse file tree
runtracker/src/main/java/com/runtracker/global/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package com .runtracker .global .config ;
2+
3+ import lombok .Getter ;
4+ import org .springframework .beans .factory .annotation .Value ;
5+ import org .springframework .context .annotation .Configuration ;
6+
7+ import jakarta .annotation .PostConstruct ;
8+ import java .io .File ;
9+
10+ @ Getter
11+ @ Configuration
12+ public class FileUploadConfig {
13+
14+ @ Value ("${file.upload-dir:/app/uploads}" )
15+ private String uploadDir ;
16+
17+ @ Value ("${app.domain:http://localhost:8080}" )
18+ private String baseUrl ;
19+
20+ @ PostConstruct
21+ public void init () {
22+ File uploadDirectory = new File (uploadDir );
23+ if (!uploadDirectory .exists () && !uploadDirectory .mkdirs ()) {
24+ throw new IllegalStateException ("Failed to create upload directory: " + uploadDir );
25+ }
26+ }
27+ }
You can’t perform that action at this time.
0 commit comments