【发布时间】:2014-07-31 17:58:33
【问题描述】:
我们有使用元注释的测试类:
@WebAppConfiguration
@ContextHierarchy({
@ContextConfiguration(locations = {"/web/WEB-INF/spring.xml" }, name = "parent"),
@ContextConfiguration("/web/WEB-INF/spring-servlet.xml")
})
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface BaseSpringTest {
}
但希望能够从测试类本身覆盖或附加到层次结构的元素,例如:
@BaseSpringTest
@ContextConfiguration(locations = {"/web/WEB-INF/spring-extension.xml" }, name = "parent")
public class MyTest extends AbstractTestNGSpringContextTests {
...
}
到目前为止,这对我们还没有奏效...是否有任何机制可以做到这一点?我找到了https://jira.spring.io/browse/SPR-11038,但我认为这不是解决这种情况的方法。
谢谢!
【问题讨论】:
-
请注意,如果您发现您的问题的答案之一可以接受,请随时accept it。
标签: java spring spring-test spring-test-mvc