0
我有一個項目的META-INF
文件夾中的應用程序上下文文件。applicationContext不加載屬性是一些文件的路徑
的目錄樹:
├── src
├── main
│ .
.
.
.
.
└── test
├── java
.
.
.
.
.
└── resources
├── META-INF
│ ├── applicationContext.annotation.config.xml
│ ├── applicationContext.annotationTestCase.config.xml
│ └── applicationContext.xml
│
├── annotation.properties
├── annotationTestCase.properties
├── query.properties
└── project.properties
在applicationContext.xml
我有一個屬性:
<property name="propFile" value="annotation.properties"/>
我喜歡private String propFile;
一個java文件中使用這個屬性。 propFile
基本上是加載到程序中的屬性文件的路徑。但只要我打開我得到:
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: java.nio.file.NoSuchFileException: annotation.properties
我還印着這是annotation.properties
的propsFile
值。
什麼可能會出錯?
的路徑是在類路徑中,而不是一個普通的文件,我建議使用溫泉資源抽象載入的文件,而不是自己動手。 –