Restructure embedded web server packages

Rework `org.springframework.boot.context.embedded` to relocate classes
to `org.springframework.boot.web`. Packages are now organized around
the following areas:

Packages for shared concerns, for example the `WebServer` interface
to start/stop a server and the common configuration elements:
- org.springframework.boot.web.context
- org.springframework.boot.web.server

Servlet specific packages:
- org.springframework.boot.web.servlet.server
- org.springframework.boot.web.servlet.context
- org.springframework.boot.web.servlet.filter

Reactive specific packages:
- org.springframework.boot.web.reactive.context
- org.springframework.boot.web.reactive.server

Embedded server implementations (both reactive and servlet):
- org.springframework.boot.web.embedded

In addition:

- Rename `EmbeddedServletContainerFactory` to `ServletWebServerFactory`
  to align with the `ReactiveWebServerFactory`.
- Rename `EmbeddedWebApplicationContext` to
  `ServletWebServerApplicationContext` and
- Rename `EmbeddedReactiveWebApplicationContext` to
  `ReactiveWebServerApplicationContext`.
- Add checkstyle rules to restrict imports.
- Fixup all affected code to use the correct imports and local names.

Fixes gh-8532
This commit is contained in:
Phillip Webb
2017-03-07 11:26:11 -08:00
parent 7b388e5865
commit 67556ba8ea
263 changed files with 2821 additions and 3287 deletions

View File

@@ -22,8 +22,10 @@ import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.context.embedded.TomcatLegacyCookieProcessorExample.LegacyCookieProcessorConfiguration;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.embedded.tomcat.TomcatWebServer;
import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
import org.springframework.boot.web.servlet.server.ServletWebServerFactoryCustomizerBeanPostProcessor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -38,10 +40,10 @@ public class TomcatLegacyCookieProcessorExampleTests {
@Test
public void cookieProcessorIsCustomized() {
EmbeddedWebApplicationContext applicationContext = (EmbeddedWebApplicationContext) new SpringApplication(
ServletWebServerApplicationContext applicationContext = (ServletWebServerApplicationContext) new SpringApplication(
TestConfiguration.class, LegacyCookieProcessorConfiguration.class).run();
Context context = (Context) ((TomcatEmbeddedServletContainer) applicationContext
.getEmbeddedWebServer()).getTomcat().getHost().findChildren()[0];
Context context = (Context) ((TomcatWebServer) applicationContext
.getWebServer()).getTomcat().getHost().findChildren()[0];
assertThat(context.getCookieProcessor())
.isInstanceOf(LegacyCookieProcessor.class);
}
@@ -50,13 +52,13 @@ public class TomcatLegacyCookieProcessorExampleTests {
static class TestConfiguration {
@Bean
public TomcatEmbeddedServletContainerFactory tomcatFactory() {
return new TomcatEmbeddedServletContainerFactory(0);
public TomcatServletWebServerFactory tomcatFactory() {
return new TomcatServletWebServerFactory(0);
}
@Bean
public EmbeddedServletContainerCustomizerBeanPostProcessor postProcessor() {
return new EmbeddedServletContainerCustomizerBeanPostProcessor();
public ServletWebServerFactoryCustomizerBeanPostProcessor postProcessor() {
return new ServletWebServerFactoryCustomizerBeanPostProcessor();
}
}