Migrate ApplicationContext to common hierarchy

This commit migrates `AnnotationConfigReactiveWebApplicationContext`
parent to the `GenericApplicationContext` abstraction. Any use of
`AnnotationConfigWebApplicationContext` is also removed as it also
inherits from the `AbstractRefreshableApplicationContext` outdated
hierarchy.

A new `AnnotationConfigServletWebApplicationContext` context is
introduced instead, extending from `GenericApplicationContext` and
providing the counter part of the reactive context for the Servlet-based
web app tests.

See gh-16096
This commit is contained in:
Stephane Nicoll
2019-04-02 10:06:33 +02:00
parent 4bcc632850
commit c432288ed1
24 changed files with 303 additions and 353 deletions

View File

@@ -27,13 +27,13 @@ import javax.servlet.http.HttpServlet;
import org.junit.Test;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mock.web.MockServletContext;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.test.web.servlet.setup.DefaultMockMvcBuilder;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import static org.assertj.core.api.Assertions.assertThat;
@@ -49,7 +49,7 @@ public class SpringBootMockMvcBuilderCustomizerTests {
@Test
@SuppressWarnings("unchecked")
public void customizeShouldAddFilters() {
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
AnnotationConfigServletWebApplicationContext context = new AnnotationConfigServletWebApplicationContext();
MockServletContext servletContext = new MockServletContext();
context.setServletContext(servletContext);
context.register(ServletConfiguration.class, FilterConfiguration.class);