0
스프링 부트 애플리케이션에서 아래 메소드를 통해 리소스 핸들러를 추가하려고합니다. 처리기는 Windows 설치 위치에 추가되지만 내 Linux 컴퓨터에 배포 할 때는 수행되지 않습니다.스프링 부트 addResourceHandlers가 리눅스에서 작동하지 않습니다.
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
//linux
registry.addResourceHandler("/content/**").addResourceLocations("file:/app/content/").setCachePeriod(0);
//windows
//registry.addResourceHandler("/content/**").addResourceLocations("file:/D:\files\").setCachePeriod(0);
}
참고 : Linux 컴퓨터의 대상 폴더에도 읽기 쓰기 권한이 있습니다. 또한 file : // 및 file : ///으로 시도했습니다.
다른 설정이 누락되었을 수 있습니다. http://myhost/content/file.jpg에있는 파일에 액세스하면 Linux에서 404가됩니다.