//获取resources下面的资源,并进行copy // 方式1 // ClassPathResource classPathResource = new ClassPathResource("static/libs/1.png"); // InputStream inputStream = classPathResource.getInputStream(); // 方式二 File file = ResourceUtils.getFile("classpath:static/libs/1.png"); InputStream inputStream = new FileInputStream(file); OutputStream outputStream = new FileOutputStream(new File("D:\\upload\\logo\\2.png")); IOUtils.copy(inputStream, outputStream);