22 lines
793 B
Java
22 lines
793 B
Java
package zw.qantra.tm.configs;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
import java.nio.file.Path;
|
|
|
|
@Configuration
|
|
public class ReportsResourceConfig implements WebMvcConfigurer {
|
|
|
|
@Value("${app.reports.storage-path:./reports}")
|
|
private String reportsStoragePath;
|
|
|
|
@Override
|
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
Path reportsDir = Path.of(reportsStoragePath).toAbsolutePath();
|
|
registry.addResourceHandler("/reports/**")
|
|
.addResourceLocations("file:" + reportsDir + "/");
|
|
}
|
|
} |