我有一个项目如下:
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
项目-B 的pom.xml:
<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。
我已经在 otherTests.java 中尝试过
@ContextConfiguration(locations = {"classpath*:spring/test-dao-config.xml"})
但这似乎不起作用...
编辑:Geoand 的回答帮助,我没有更多与豆类有关的例外,但现在我有一个
FileNotFoundException:类路径资源 [exception-messages.properties] 无法打开,因为它不存在。
由于我不完全了解所做的更改,因此我不知道如何解决此问题... webapp-config.xml中使用异常消息作为<context:property-placeholder location="classpath:exception-messages.properties" />