FYI: The value
attribute for @WebAppConfiguration
is not an XML configuration file but rather the root directory of your web application. So your current test configuration could never work.
Assuming that applicationContext.xml
and webmvc-config.xml
are the XML configuration files for your root and DispatcherServlet
WebApplicationContext
s, respectively, try redefining AbstractContextControllerTests
as follows:
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextHierarchy ({
@ContextConfiguration("/META-INF/spring/applicationContext.xml"),
@ContextConfiguration("file:src/main/webapp/WEB-INF/spring/webmvc-config.xml")
})
public abstract class AbstractContextControllerTests {
@Autowired
protected WebApplicationContext wac;
}
By the way, abstract test classes must actually be declared as abstract
. ;)
Regards,
Sam (author of the Spring TestContext Framework)