我有一個名爲X
項目,該項目具有wireup.xml
奠定如下:Spring:如何從jar classpath加載@ContextConfiguration?我得到FileNotFoundException異常
X/
Module/
src/
main/
resources/
com.here/
wireup.xml
我進口的project X
Module
在project Y
作爲
<dependency>
<groupId>com.org.X</groupId>
<artifactId>Module</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
現在,在測試中,我想豆是在wireup.xml
,所以我做了以下操作:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:com/org/X/Module/src/main/resources/com/here/wireup.xml"})
public class MongoSaverTest extends Case {
@Autowired
private SomeBeanInWireup variable;
}
但我得到上運行的測試說
Caused by: java.io.FileNotFoundException: class path resource [com/org/X/Module/src/main/resources/com/here/wireup.xml] cannot be opened because it does not exist
如何解決這個問題?我如何知道正確的路徑?