我正在开发一个Spring Boot应用程序,其中添加了一个依赖项。这个依赖项有一个spring.xml文件。我正在扫描这个xml文件,并创建bean。其中一个bean正在查找类路径下的hibernate.properties。我已经将此属性文件添加到我的应用程序的资源文件夹下。然而,我仍然看到下面列出的异常。请问我漏掉了什么?
<util:properties id="HibernateProperties" location="classpath:hibernate.properties"/>
java.io.FileNotFoundException: 类路径资源 [hibernate.properties] 无法打开,因为它不存在。
classpath:/hibernate.properties
吗? - Jim Garrisonmvn spring-boot:run
时,删除classpath:
对我有用。当我打包并运行java -jar target\App.war
时也有效。 - Chloe