我们有使用元注释的测试类:
@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,但我认为这不是解决这种情况的方法。
谢谢!