Restructure web auto-configuration

Restructure `org.springframework.boot.autoconfigure.web` to better align
with the new package structure in `spring-boot`.

Auto-configuration is now split into client, servlet and reactive
sub-packages. In addition a new `http` package now handles common
HTTP concerns.

Fixes gh-8616
This commit is contained in:
Phillip Webb
2017-03-14 18:06:53 -07:00
parent 33e54ed723
commit b76ca0bf8f
166 changed files with 634 additions and 536 deletions

View File

@@ -16,7 +16,12 @@
package org.springframework.boot.web.reactive.server;
import java.net.URL;
import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -31,6 +36,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.server.reactive.HttpHandler;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.util.SocketUtils;
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.client.ClientResponse;
@@ -68,6 +74,14 @@ public abstract class AbstractReactiveWebServerFactoryTests {
}
}
@BeforeClass
@AfterClass
public static void uninstallUrlStreamHandlerFactory() {
ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance",
null);
ReflectionTestUtils.setField(URL.class, "factory", null);
}
protected abstract AbstractReactiveWebServerFactory getFactory();
@Test

View File

@@ -17,9 +17,13 @@
package org.springframework.boot.web.servlet.context;
import java.net.URI;
import java.net.URL;
import java.nio.charset.Charset;
import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory;
@@ -38,6 +42,7 @@ import org.springframework.http.client.ClientHttpRequest;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.stereotype.Controller;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.util.StreamUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@@ -67,6 +72,14 @@ public class ServletWebServerMvcIntegrationTests {
}
}
@BeforeClass
@AfterClass
public static void uninstallUrlStreamHandlerFactory() {
ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance",
null);
ReflectionTestUtils.setField(URL.class, "factory", null);
}
@Test
public void tomcat() throws Exception {
this.context = new AnnotationConfigServletWebServerApplicationContext(