SpringBoot 가 Linux 서버 에 배 치 된 정적 자원 문 제 를 찾 을 수 없습니다.

618 단어 springboot
//
//      Springboot   web  ,        jar  ,           ,
//           ,        jar ,       ,this.getClass().getResource("/")+fileName   windows        ,
//      ;File logoFile = new File(ClassUtils.getDefaultClassLoader().getResource("").getPath() + "static/images/codelogo.jpg"),
//       linux         ,    jar          ,   file。
    public static InputStream getInputStream(String path) throws IOException {
        ClassPathResource classPathResource = new ClassPathResource(path);
        return classPathResource.getInputStream();
    }
 

좋은 웹페이지 즐겨찾기