void configure( MergedContextConfiguration configuration, SpringApplication application, List<ApplicationContextInitializer<?>> initializers) { WebMergedContextConfiguration webConfiguration = (WebMergedContextConfiguration) configuration; if (AnnotationUtils.findAnnotation(webConfiguration.getTestClass(), IntegrationTest.class) == null) { MockServletContext servletContext = new MockServletContext(webConfiguration.getResourceBasePath()); initializers.add(0, new ServletContextApplicationContextInitializer(servletContext)); application.setApplicationContextClass(GenericWebApplicationContext.class); } }