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

@@ -28,6 +28,7 @@ import org.springframework.boot.devtools.restart.MockRestarter;
import org.springframework.boot.devtools.restart.server.HttpRestartServer;
import org.springframework.boot.devtools.restart.server.SourceFolderUrlFilter;
import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@@ -37,7 +38,6 @@ import org.springframework.mock.web.MockFilterChain;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@@ -58,7 +58,7 @@ public class RemoteDevToolsAutoConfigurationTests {
@Rule
public MockRestarter mockRestarter = new MockRestarter();
private AnnotationConfigWebApplicationContext context;
private AnnotationConfigServletWebApplicationContext context;
private MockHttpServletRequest request;
@@ -174,7 +174,7 @@ public class RemoteDevToolsAutoConfigurationTests {
}
private void loadContext(String... properties) {
this.context = new AnnotationConfigWebApplicationContext();
this.context = new AnnotationConfigServletWebApplicationContext();
this.context.setServletContext(new MockServletContext());
this.context.register(Config.class, PropertyPlaceholderAutoConfiguration.class);
TestPropertyValues.of(properties).applyTo(this.context);