以下是加载资源文件并将资源分配给文件对象的代码。
@Value("classpath:responsexml/TestLoadResponse.xml") /* Used value attribute for loading the file from the specified path */
File testLoadResponse ; /* Assigning the variable */
以上在eclipse中工作正常但是当部署了spring boot应用程序jar时,我面临以下错误
**exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.io.File'; nested exception is java.lang.IllegalArgumentException: Could not retrieve file for class path resource**