2

我有一个名为的项目X,其wireup.xml布局如下:

X/
 Module/
       src/
           main/
               resources/
                        com.here/
                                wireup.xml  

我 导入Moduleproject X_project Y

    <dependency>
        <groupId>com.org.X</groupId>
        <artifactId>Module</artifactId>
        <version>master-SNAPSHOT</version>
    </dependency>  

现在在测试中我想要 bean 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

我怎样才能解决这个问题?我怎样才能知道正确的路径?

4

2 回答 2

3

它应该只是@ContextConfiguration(locations = {"classpath:com/here/wireup.xml"})

于 2012-07-09T19:57:09.877 回答
0

您的资源的路径是classpath:com/here/wireup.xml

于 2012-07-09T19:57:37.803 回答