//獲取跟目錄
String pathPrefix = ResourceUtils.getURL("classpath:").getPath();
File file = new File(pathPrefix);
if(!file.exists()) file = new File("");
System.out.println("file path:"+file.getAbsolutePath());
//獲取文件可以直接如下
//File file = new File("classpath: static/images/test.png");
//如果上傳目錄為/static/images/upload/,則可以如下獲取:
File upload = new File(file.getAbsolutePath(),"static/images/upload/");
if(!upload.exists()) upload.mkdirs();
System.out.println("upload url:"+upload.getAbsolutePath());
//在開發測試模式時,得到的地址為:{項目跟目錄}/target/static/images/upload/
