Reputation: 91959
I have a project called X
which has wireup.xml
laid as follows :
X/
Module/
src/
main/
resources/
com.here/
wireup.xml
I import Module
of project X
in project Y
as
<dependency>
<groupId>com.org.X</groupId>
<artifactId>Module</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
Now in the test I want bean that is in wireup.xml
, so I do the following :
@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;
}
But I get error on running the test saying
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
How can I fix this? How can I know the correct path?
Upvotes: 2
Views: 3692
Reputation: 23903
The path for your resource is classpath:com/here/wireup.xml
Upvotes: 0
Reputation: 49915
It should just be @ContextConfiguration(locations = {"classpath:com/here/wireup.xml"})
Upvotes: 3