Skip to content

Commit 5a9ca67

Browse files
committed
Start building against Spring Framework 6.2.0-M2 snapshots
See spring-projectsgh-36198
1 parent 1fa079d commit 5a9ca67

File tree

7 files changed

+44
-8
lines changed

7 files changed

+44
-8
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8
66

77
kotlinVersion=1.8.22
88
nativeBuildToolsVersion=0.9.23
9-
springFrameworkVersion=6.1.0-M1
9+
springFrameworkVersion=6.1.0-SNAPSHOT
1010
tomcatVersion=10.1.10
1111

1212
kotlin.stdlib.default.dependency=false

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,18 @@ public DispatcherServlet dispatcherServlet(WebMvcProperties webMvcProperties) {
8989
DispatcherServlet dispatcherServlet = new DispatcherServlet();
9090
dispatcherServlet.setDispatchOptionsRequest(webMvcProperties.isDispatchOptionsRequest());
9191
dispatcherServlet.setDispatchTraceRequest(webMvcProperties.isDispatchTraceRequest());
92-
dispatcherServlet.setThrowExceptionIfNoHandlerFound(webMvcProperties.isThrowExceptionIfNoHandlerFound());
92+
configureThrowExceptionIfNoHandlerFound(webMvcProperties, dispatcherServlet);
9393
dispatcherServlet.setPublishEvents(webMvcProperties.isPublishRequestHandledEvents());
9494
dispatcherServlet.setEnableLoggingRequestDetails(webMvcProperties.isLogRequestDetails());
9595
return dispatcherServlet;
9696
}
9797

98+
@SuppressWarnings({ "deprecation", "removal" })
99+
private void configureThrowExceptionIfNoHandlerFound(WebMvcProperties webMvcProperties,
100+
DispatcherServlet dispatcherServlet) {
101+
dispatcherServlet.setThrowExceptionIfNoHandlerFound(webMvcProperties.isThrowExceptionIfNoHandlerFound());
102+
}
103+
98104
@Bean
99105
@ConditionalOnBean(MultipartResolver.class)
100106
@ConditionalOnMissingBean(name = DispatcherServlet.MULTIPART_RESOLVER_BEAN_NAME)

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcProperties.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.Map;
2222

2323
import org.springframework.boot.context.properties.ConfigurationProperties;
24+
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
2425
import org.springframework.http.MediaType;
2526
import org.springframework.util.Assert;
2627
import org.springframework.validation.DefaultMessageCodesResolver;
@@ -64,8 +65,10 @@ public class WebMvcProperties {
6465
/**
6566
* Whether a "NoHandlerFoundException" should be thrown if no Handler was found to
6667
* process a request.
68+
* @deprecated since 3.2.0 for removal in 3.4.0
6769
*/
68-
private boolean throwExceptionIfNoHandlerFound = false;
70+
@Deprecated(since = "3.2.0", forRemoval = true)
71+
private boolean throwExceptionIfNoHandlerFound = true;
6972

7073
/**
7174
* Whether logging of (potentially sensitive) request details at DEBUG and TRACE level
@@ -121,10 +124,14 @@ public void setPublishRequestHandledEvents(boolean publishRequestHandledEvents)
121124
this.publishRequestHandledEvents = publishRequestHandledEvents;
122125
}
123126

127+
@Deprecated(since = "3.2.0", forRemoval = true)
128+
@DeprecatedConfigurationProperty(
129+
reason = "DispatcherServlet property is deprecated for removal and should no longer need to be configured")
124130
public boolean isThrowExceptionIfNoHandlerFound() {
125131
return this.throwExceptionIfNoHandlerFound;
126132
}
127133

134+
@Deprecated(since = "3.2.0", forRemoval = true)
128135
public void setThrowExceptionIfNoHandlerFound(boolean throwExceptionIfNoHandlerFound) {
129136
this.throwExceptionIfNoHandlerFound = throwExceptionIfNoHandlerFound;
130137
}

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfigurationTests.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ void renamesMultipartResolver() {
141141
void dispatcherServletDefaultConfig() {
142142
this.contextRunner.run((context) -> {
143143
DispatcherServlet dispatcherServlet = context.getBean(DispatcherServlet.class);
144-
assertThat(dispatcherServlet).extracting("throwExceptionIfNoHandlerFound").isEqualTo(false);
145144
assertThat(dispatcherServlet).extracting("dispatchOptionsRequest").isEqualTo(true);
146145
assertThat(dispatcherServlet).extracting("dispatchTraceRequest").isEqualTo(false);
147146
assertThat(dispatcherServlet).extracting("enableLoggingRequestDetails").isEqualTo(false);
@@ -151,15 +150,24 @@ void dispatcherServletDefaultConfig() {
151150
});
152151
}
153152

153+
@Test
154+
@Deprecated(since = "3.2.0", forRemoval = true)
155+
void dispatcherServletThrowExceptionIfNoHandlerFoundDefaultConfig() {
156+
this.contextRunner.run((context) -> {
157+
DispatcherServlet dispatcherServlet = context.getBean(DispatcherServlet.class);
158+
assertThat(dispatcherServlet).extracting("throwExceptionIfNoHandlerFound").isEqualTo(true);
159+
});
160+
}
161+
154162
@Test
155163
void dispatcherServletCustomConfig() {
156164
this.contextRunner
157-
.withPropertyValues("spring.mvc.throw-exception-if-no-handler-found:true",
165+
.withPropertyValues("spring.mvc.throw-exception-if-no-handler-found:false",
158166
"spring.mvc.dispatch-options-request:false", "spring.mvc.dispatch-trace-request:true",
159167
"spring.mvc.publish-request-handled-events:false", "spring.mvc.servlet.load-on-startup=5")
160168
.run((context) -> {
161169
DispatcherServlet dispatcherServlet = context.getBean(DispatcherServlet.class);
162-
assertThat(dispatcherServlet).extracting("throwExceptionIfNoHandlerFound").isEqualTo(true);
170+
assertThat(dispatcherServlet).extracting("throwExceptionIfNoHandlerFound").isEqualTo(false);
163171
assertThat(dispatcherServlet).extracting("dispatchOptionsRequest").isEqualTo(false);
164172
assertThat(dispatcherServlet).extracting("dispatchTraceRequest").isEqualTo(true);
165173
assertThat(dispatcherServlet).extracting("publishEvents").isEqualTo(false);
@@ -168,6 +176,15 @@ void dispatcherServletCustomConfig() {
168176
});
169177
}
170178

179+
@Test
180+
@Deprecated(since = "3.2.0", forRemoval = true)
181+
void dispatcherServletThrowExceptionIfNoHandlerFoundCustomConfig() {
182+
this.contextRunner.withPropertyValues("spring.mvc.throw-exception-if-no-handler-found:false").run((context) -> {
183+
DispatcherServlet dispatcherServlet = context.getBean(DispatcherServlet.class);
184+
assertThat(dispatcherServlet).extracting("throwExceptionIfNoHandlerFound").isEqualTo(false);
185+
});
186+
}
187+
171188
@Configuration(proxyBeanMethods = false)
172189
static class MultipartConfiguration {
173190

spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcAutoConfiguration.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ private static class MockMvcDispatcherServletCustomizer implements DispatcherSer
131131
public void customize(DispatcherServlet dispatcherServlet) {
132132
dispatcherServlet.setDispatchOptionsRequest(this.webMvcProperties.isDispatchOptionsRequest());
133133
dispatcherServlet.setDispatchTraceRequest(this.webMvcProperties.isDispatchTraceRequest());
134+
configureThrowExceptionIfNoHandlerFound(dispatcherServlet);
135+
}
136+
137+
@SuppressWarnings({ "deprecation", "removal" })
138+
private void configureThrowExceptionIfNoHandlerFound(DispatcherServlet dispatcherServlet) {
134139
dispatcherServlet
135140
.setThrowExceptionIfNoHandlerFound(this.webMvcProperties.isThrowExceptionIfNoHandlerFound());
136141
}

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/JarIntegrationTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,8 @@ private String buildJarWithOutputTimestamp(MavenBuild mavenBuild) {
428428
void whenJarIsRepackagedWithOutputTimestampConfiguredThenLibrariesAreSorted(MavenBuild mavenBuild) {
429429
mavenBuild.project("jar-output-timestamp").execute((project) -> {
430430
File repackaged = new File(project, "target/jar-output-timestamp-0.0.1.BUILD-SNAPSHOT.jar");
431-
List<String> sortedLibs = Arrays.asList("BOOT-INF/lib/jakarta.servlet-api", "BOOT-INF/lib/spring-aop",
431+
List<String> sortedLibs = Arrays.asList("BOOT-INF/lib/jakarta.servlet-api",
432+
"BOOT-INF/lib/micrometer-commons", "BOOT-INF/lib/micrometer-observation", "BOOT-INF/lib/spring-aop",
432433
"BOOT-INF/lib/spring-beans", "BOOT-INF/lib/spring-boot-jarmode-layertools",
433434
"BOOT-INF/lib/spring-context", "BOOT-INF/lib/spring-core", "BOOT-INF/lib/spring-expression",
434435
"BOOT-INF/lib/spring-jcl");

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesHttpComponentsTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ClientHttpRequestFactoriesHttpComponentsTests
3939

4040
@Override
4141
protected long connectTimeout(HttpComponentsClientHttpRequestFactory requestFactory) {
42-
return (int) ReflectionTestUtils.getField(requestFactory, "connectTimeout");
42+
return (long) ReflectionTestUtils.getField(requestFactory, "connectTimeout");
4343
}
4444

4545
@Override

0 commit comments

Comments
 (0)