【发布时间】:2014-04-07 16:42:16
【问题描述】:
我有一个项目如下:
Project
Project-A/
src/test/java/
someTests.java
src/test/resources
database/
create.sql
insert.sql
spring/
test-config.xml
project-B/
src/test/java
otherTests.java
pom.xml 的 Project-B:
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>Project-A</artifactId>
</dependency>
而在someTests.java中,我的配置是:
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(locations = { "file:src/main/webapp/WEB-INF/spring/webapp-config.xml", "classpath:spring/test-dao-config.xml" })
public class DacsDAOImplTest
我想在otherTests.java中重用test-config.xml、create.sql和insert.sql em>。
我已经在 otherTests.java 中尝试过
@ContextConfiguration(locations = {"classpath*:spring/test-dao-config.xml"})
但这似乎不起作用......
编辑:Geoand的回答帮助,我没有更多与bean相关的例外,但现在我有一个
FileNotFoundException:类路径资源 [exception-messages.properties] 无法打开,因为它没有 存在。
由于我不了解具体做了哪些更改,所以我不知道如何解决这个问题...
异常消息在 webapp-config.xml 中用作 <context:property-placeholder location="classpath:exception-messages.properties" />
【问题讨论】:
标签: spring junit spring-test spring-test-mvc