mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Start building against Spring Framework 6.2.0-M2 snapshots
See gh-36198
This commit is contained in:
parent
1fa079d9b5
commit
5a9ca67fba
@ -6,7 +6,7 @@ org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8
|
||||
|
||||
kotlinVersion=1.8.22
|
||||
nativeBuildToolsVersion=0.9.23
|
||||
springFrameworkVersion=6.1.0-M1
|
||||
springFrameworkVersion=6.1.0-SNAPSHOT
|
||||
tomcatVersion=10.1.10
|
||||
|
||||
kotlin.stdlib.default.dependency=false
|
||||
|
@ -89,12 +89,18 @@ public class DispatcherServletAutoConfiguration {
|
||||
DispatcherServlet dispatcherServlet = new DispatcherServlet();
|
||||
dispatcherServlet.setDispatchOptionsRequest(webMvcProperties.isDispatchOptionsRequest());
|
||||
dispatcherServlet.setDispatchTraceRequest(webMvcProperties.isDispatchTraceRequest());
|
||||
dispatcherServlet.setThrowExceptionIfNoHandlerFound(webMvcProperties.isThrowExceptionIfNoHandlerFound());
|
||||
configureThrowExceptionIfNoHandlerFound(webMvcProperties, dispatcherServlet);
|
||||
dispatcherServlet.setPublishEvents(webMvcProperties.isPublishRequestHandledEvents());
|
||||
dispatcherServlet.setEnableLoggingRequestDetails(webMvcProperties.isLogRequestDetails());
|
||||
return dispatcherServlet;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "deprecation", "removal" })
|
||||
private void configureThrowExceptionIfNoHandlerFound(WebMvcProperties webMvcProperties,
|
||||
DispatcherServlet dispatcherServlet) {
|
||||
dispatcherServlet.setThrowExceptionIfNoHandlerFound(webMvcProperties.isThrowExceptionIfNoHandlerFound());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBean(MultipartResolver.class)
|
||||
@ConditionalOnMissingBean(name = DispatcherServlet.MULTIPART_RESOLVER_BEAN_NAME)
|
||||
|
@ -21,6 +21,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.validation.DefaultMessageCodesResolver;
|
||||
@ -64,8 +65,10 @@ public class WebMvcProperties {
|
||||
/**
|
||||
* Whether a "NoHandlerFoundException" should be thrown if no Handler was found to
|
||||
* process a request.
|
||||
* @deprecated since 3.2.0 for removal in 3.4.0
|
||||
*/
|
||||
private boolean throwExceptionIfNoHandlerFound = false;
|
||||
@Deprecated(since = "3.2.0", forRemoval = true)
|
||||
private boolean throwExceptionIfNoHandlerFound = true;
|
||||
|
||||
/**
|
||||
* Whether logging of (potentially sensitive) request details at DEBUG and TRACE level
|
||||
@ -121,10 +124,14 @@ public class WebMvcProperties {
|
||||
this.publishRequestHandledEvents = publishRequestHandledEvents;
|
||||
}
|
||||
|
||||
@Deprecated(since = "3.2.0", forRemoval = true)
|
||||
@DeprecatedConfigurationProperty(
|
||||
reason = "DispatcherServlet property is deprecated for removal and should no longer need to be configured")
|
||||
public boolean isThrowExceptionIfNoHandlerFound() {
|
||||
return this.throwExceptionIfNoHandlerFound;
|
||||
}
|
||||
|
||||
@Deprecated(since = "3.2.0", forRemoval = true)
|
||||
public void setThrowExceptionIfNoHandlerFound(boolean throwExceptionIfNoHandlerFound) {
|
||||
this.throwExceptionIfNoHandlerFound = throwExceptionIfNoHandlerFound;
|
||||
}
|
||||
|
@ -141,7 +141,6 @@ class DispatcherServletAutoConfigurationTests {
|
||||
void dispatcherServletDefaultConfig() {
|
||||
this.contextRunner.run((context) -> {
|
||||
DispatcherServlet dispatcherServlet = context.getBean(DispatcherServlet.class);
|
||||
assertThat(dispatcherServlet).extracting("throwExceptionIfNoHandlerFound").isEqualTo(false);
|
||||
assertThat(dispatcherServlet).extracting("dispatchOptionsRequest").isEqualTo(true);
|
||||
assertThat(dispatcherServlet).extracting("dispatchTraceRequest").isEqualTo(false);
|
||||
assertThat(dispatcherServlet).extracting("enableLoggingRequestDetails").isEqualTo(false);
|
||||
@ -151,15 +150,24 @@ class DispatcherServletAutoConfigurationTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@Deprecated(since = "3.2.0", forRemoval = true)
|
||||
void dispatcherServletThrowExceptionIfNoHandlerFoundDefaultConfig() {
|
||||
this.contextRunner.run((context) -> {
|
||||
DispatcherServlet dispatcherServlet = context.getBean(DispatcherServlet.class);
|
||||
assertThat(dispatcherServlet).extracting("throwExceptionIfNoHandlerFound").isEqualTo(true);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void dispatcherServletCustomConfig() {
|
||||
this.contextRunner
|
||||
.withPropertyValues("spring.mvc.throw-exception-if-no-handler-found:true",
|
||||
.withPropertyValues("spring.mvc.throw-exception-if-no-handler-found:false",
|
||||
"spring.mvc.dispatch-options-request:false", "spring.mvc.dispatch-trace-request:true",
|
||||
"spring.mvc.publish-request-handled-events:false", "spring.mvc.servlet.load-on-startup=5")
|
||||
.run((context) -> {
|
||||
DispatcherServlet dispatcherServlet = context.getBean(DispatcherServlet.class);
|
||||
assertThat(dispatcherServlet).extracting("throwExceptionIfNoHandlerFound").isEqualTo(true);
|
||||
assertThat(dispatcherServlet).extracting("throwExceptionIfNoHandlerFound").isEqualTo(false);
|
||||
assertThat(dispatcherServlet).extracting("dispatchOptionsRequest").isEqualTo(false);
|
||||
assertThat(dispatcherServlet).extracting("dispatchTraceRequest").isEqualTo(true);
|
||||
assertThat(dispatcherServlet).extracting("publishEvents").isEqualTo(false);
|
||||
@ -168,6 +176,15 @@ class DispatcherServletAutoConfigurationTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@Deprecated(since = "3.2.0", forRemoval = true)
|
||||
void dispatcherServletThrowExceptionIfNoHandlerFoundCustomConfig() {
|
||||
this.contextRunner.withPropertyValues("spring.mvc.throw-exception-if-no-handler-found:false").run((context) -> {
|
||||
DispatcherServlet dispatcherServlet = context.getBean(DispatcherServlet.class);
|
||||
assertThat(dispatcherServlet).extracting("throwExceptionIfNoHandlerFound").isEqualTo(false);
|
||||
});
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class MultipartConfiguration {
|
||||
|
||||
|
@ -131,6 +131,11 @@ public class MockMvcAutoConfiguration {
|
||||
public void customize(DispatcherServlet dispatcherServlet) {
|
||||
dispatcherServlet.setDispatchOptionsRequest(this.webMvcProperties.isDispatchOptionsRequest());
|
||||
dispatcherServlet.setDispatchTraceRequest(this.webMvcProperties.isDispatchTraceRequest());
|
||||
configureThrowExceptionIfNoHandlerFound(dispatcherServlet);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "deprecation", "removal" })
|
||||
private void configureThrowExceptionIfNoHandlerFound(DispatcherServlet dispatcherServlet) {
|
||||
dispatcherServlet
|
||||
.setThrowExceptionIfNoHandlerFound(this.webMvcProperties.isThrowExceptionIfNoHandlerFound());
|
||||
}
|
||||
|
@ -428,7 +428,8 @@ class JarIntegrationTests extends AbstractArchiveIntegrationTests {
|
||||
void whenJarIsRepackagedWithOutputTimestampConfiguredThenLibrariesAreSorted(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-output-timestamp").execute((project) -> {
|
||||
File repackaged = new File(project, "target/jar-output-timestamp-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
List<String> sortedLibs = Arrays.asList("BOOT-INF/lib/jakarta.servlet-api", "BOOT-INF/lib/spring-aop",
|
||||
List<String> sortedLibs = Arrays.asList("BOOT-INF/lib/jakarta.servlet-api",
|
||||
"BOOT-INF/lib/micrometer-commons", "BOOT-INF/lib/micrometer-observation", "BOOT-INF/lib/spring-aop",
|
||||
"BOOT-INF/lib/spring-beans", "BOOT-INF/lib/spring-boot-jarmode-layertools",
|
||||
"BOOT-INF/lib/spring-context", "BOOT-INF/lib/spring-core", "BOOT-INF/lib/spring-expression",
|
||||
"BOOT-INF/lib/spring-jcl");
|
||||
|
@ -39,7 +39,7 @@ class ClientHttpRequestFactoriesHttpComponentsTests
|
||||
|
||||
@Override
|
||||
protected long connectTimeout(HttpComponentsClientHttpRequestFactory requestFactory) {
|
||||
return (int) ReflectionTestUtils.getField(requestFactory, "connectTimeout");
|
||||
return (long) ReflectionTestUtils.getField(requestFactory, "connectTimeout");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user