0
我想要定義一個相對路徑而不是彈簧mvc的絕對路徑。任何人有任何想法如何做到這一點?Spring MVC絕對路徑到相對路徑
private static final String FILE_PATH = "/Users/andyhe/Documents/workspace-sts-3.8.3.RELEASE/gti660/Equipe5/src/iTunesClone - Lab 2/iTunesClone/WebContent/resources/download/json/recherche.json";
private File getFileP() throws FileNotFoundException {
File file = new File(FILE_PATH);
if (!file.exists()){
throw new FileNotFoundException("file with path: " + FILE_PATH + " was not found.");
}
return file;
}
非常感謝,從來沒有想過這個.. – AndyHe
@AndyHe \t 很高興幫助:)如果一切正常,請接受的答案。 –