Skip to content

Commit f2ef8f9

Browse files
committed
Start building against Spring Framework 5.3.12 snapshots
This reverts commit 196013f, reversing changes made to 8b0c563. Closes gh-28384 See gh-28241
1 parent feed904 commit f2ef8f9

File tree

5 files changed

+17
-42
lines changed

5 files changed

+17
-42
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration.java

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
package org.springframework.boot.autoconfigure.web.reactive;
1818

1919
import java.time.Duration;
20-
import java.util.ArrayList;
21-
import java.util.List;
2220

2321
import org.apache.commons.logging.Log;
2422
import org.apache.commons.logging.LogFactory;
@@ -52,7 +50,6 @@
5250
import org.springframework.context.annotation.Import;
5351
import org.springframework.core.Ordered;
5452
import org.springframework.core.annotation.Order;
55-
import org.springframework.core.io.ResourceLoader;
5653
import org.springframework.format.FormatterRegistry;
5754
import org.springframework.format.support.FormattingConversionService;
5855
import org.springframework.http.codec.ServerCodecConfigurer;
@@ -159,14 +156,12 @@ public static class WebFluxConfig implements WebFluxConfigurer {
159156

160157
private final ObjectProvider<ViewResolver> viewResolvers;
161158

162-
private final ResourceLoader resourceLoader;
163-
164159
public WebFluxConfig(org.springframework.boot.autoconfigure.web.ResourceProperties resourceProperties,
165160
WebProperties webProperties, WebFluxProperties webFluxProperties, ListableBeanFactory beanFactory,
166161
ObjectProvider<HandlerMethodArgumentResolver> resolvers,
167162
ObjectProvider<CodecCustomizer> codecCustomizers,
168163
ObjectProvider<ResourceHandlerRegistrationCustomizer> resourceHandlerRegistrationCustomizer,
169-
ObjectProvider<ViewResolver> viewResolvers, ResourceLoader resourceLoader) {
164+
ObjectProvider<ViewResolver> viewResolvers) {
170165
this.resourceProperties = resourceProperties.hasBeenCustomized() ? resourceProperties
171166
: webProperties.getResources();
172167
this.webFluxProperties = webFluxProperties;
@@ -175,7 +170,6 @@ public WebFluxConfig(org.springframework.boot.autoconfigure.web.ResourceProperti
175170
this.codecCustomizers = codecCustomizers;
176171
this.resourceHandlerRegistrationCustomizer = resourceHandlerRegistrationCustomizer.getIfAvailable();
177172
this.viewResolvers = viewResolvers;
178-
this.resourceLoader = resourceLoader;
179173
}
180174

181175
@Override
@@ -195,28 +189,17 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) {
195189
return;
196190
}
197191
if (!registry.hasMappingForPattern("/webjars/**")) {
198-
String webjarsLocation = "classpath:/META-INF/resources/webjars/";
199-
if (this.resourceLoader.getResource(webjarsLocation).exists()) {
200-
ResourceHandlerRegistration registration = registry.addResourceHandler("/webjars/**")
201-
.addResourceLocations(webjarsLocation);
202-
configureResourceCaching(registration);
203-
customizeResourceHandlerRegistration(registration);
204-
}
192+
ResourceHandlerRegistration registration = registry.addResourceHandler("/webjars/**")
193+
.addResourceLocations("classpath:/META-INF/resources/webjars/");
194+
configureResourceCaching(registration);
195+
customizeResourceHandlerRegistration(registration);
205196
}
206197
String staticPathPattern = this.webFluxProperties.getStaticPathPattern();
207198
if (!registry.hasMappingForPattern(staticPathPattern)) {
208-
List<String> foundLocations = new ArrayList<>();
209-
for (String staticLocation : this.resourceProperties.getStaticLocations()) {
210-
if (this.resourceLoader.getResource(staticLocation).exists()) {
211-
foundLocations.add(staticLocation);
212-
}
213-
}
214-
if (!foundLocations.isEmpty()) {
215-
ResourceHandlerRegistration registration = registry.addResourceHandler(staticPathPattern)
216-
.addResourceLocations(foundLocations.toArray(new String[0]));
217-
configureResourceCaching(registration);
218-
customizeResourceHandlerRegistration(registration);
219-
}
199+
ResourceHandlerRegistration registration = registry.addResourceHandler(staticPathPattern)
200+
.addResourceLocations(this.resourceProperties.getStaticLocations());
201+
configureResourceCaching(registration);
202+
customizeResourceHandlerRegistration(registration);
220203
}
221204
}
222205

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,6 @@ public static class WebMvcAutoConfigurationAdapter implements WebMvcConfigurer,
201201

202202
private final ResourceHandlerRegistrationCustomizer resourceHandlerRegistrationCustomizer;
203203

204-
private final ResourceLoader resourceLoader;
205-
206204
private ServletContext servletContext;
207205

208206
public WebMvcAutoConfigurationAdapter(
@@ -211,7 +209,7 @@ public WebMvcAutoConfigurationAdapter(
211209
ObjectProvider<HttpMessageConverters> messageConvertersProvider,
212210
ObjectProvider<ResourceHandlerRegistrationCustomizer> resourceHandlerRegistrationCustomizerProvider,
213211
ObjectProvider<DispatcherServletPath> dispatcherServletPath,
214-
ObjectProvider<ServletRegistrationBean<?>> servletRegistrations, ResourceLoader resourceLoader) {
212+
ObjectProvider<ServletRegistrationBean<?>> servletRegistrations) {
215213
this.resourceProperties = resourceProperties.hasBeenCustomized() ? resourceProperties
216214
: webProperties.getResources();
217215
this.mvcProperties = mvcProperties;
@@ -220,7 +218,6 @@ public WebMvcAutoConfigurationAdapter(
220218
this.resourceHandlerRegistrationCustomizer = resourceHandlerRegistrationCustomizerProvider.getIfAvailable();
221219
this.dispatcherServletPath = dispatcherServletPath;
222220
this.servletRegistrations = servletRegistrations;
223-
this.resourceLoader = resourceLoader;
224221
this.mvcProperties.checkConfiguration();
225222
}
226223

@@ -337,11 +334,7 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) {
337334
logger.debug("Default resource handling disabled");
338335
return;
339336
}
340-
Resource webjarsLocationResource = this.resourceLoader
341-
.getResource("classpath:/META-INF/resources/webjars/");
342-
if (webjarsLocationResource.exists()) {
343-
addResourceHandler(registry, "/webjars/**", webjarsLocationResource);
344-
}
337+
addResourceHandler(registry, "/webjars/**", "classpath:/META-INF/resources/webjars/");
345338
addResourceHandler(registry, this.mvcProperties.getStaticPathPattern(), (registration) -> {
346339
registration.addResourceLocations(this.resourceProperties.getStaticLocations());
347340
if (this.servletContext != null) {
@@ -351,7 +344,7 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) {
351344
});
352345
}
353346

354-
private void addResourceHandler(ResourceHandlerRegistry registry, String pattern, Resource... locations) {
347+
private void addResourceHandler(ResourceHandlerRegistry registry, String pattern, String... locations) {
355348
addResourceHandler(registry, pattern, (registration) -> registration.addResourceLocations(locations));
356349
}
357350

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,9 @@ void shouldRegisterResourceHandlerMapping() {
157157
SimpleUrlHandlerMapping hm = context.getBean("resourceHandlerMapping", SimpleUrlHandlerMapping.class);
158158
assertThat(hm.getUrlMap().get("/**")).isInstanceOf(ResourceWebHandler.class);
159159
ResourceWebHandler staticHandler = (ResourceWebHandler) hm.getUrlMap().get("/**");
160-
assertThat(staticHandler).extracting("locationValues").asList().hasSize(2);
161-
assertThat(staticHandler.getLocations()).hasSize(2);
162-
assertThat(staticHandler.getLocations().get(0)).hasToString("class path resource [META-INF/resources/]");
163-
assertThat(staticHandler.getLocations().get(1)).hasToString("class path resource [public/]");
160+
assertThat(staticHandler).extracting("locationValues").asList().hasSize(4);
161+
assertThat(staticHandler.getLocations()).hasSize(1);
162+
assertThat(staticHandler.getLocations().get(0)).hasToString("class path resource [public/]");
164163
assertThat(hm.getUrlMap().get("/webjars/**")).isInstanceOf(ResourceWebHandler.class);
165164
ResourceWebHandler webjarsHandler = (ResourceWebHandler) hm.getUrlMap().get("/webjars/**");
166165
assertThat(webjarsHandler).extracting("locationValues").asList()
@@ -174,7 +173,7 @@ void shouldMapResourcesToCustomPath() {
174173
SimpleUrlHandlerMapping hm = context.getBean("resourceHandlerMapping", SimpleUrlHandlerMapping.class);
175174
assertThat(hm.getUrlMap().get("/static/**")).isInstanceOf(ResourceWebHandler.class);
176175
ResourceWebHandler staticHandler = (ResourceWebHandler) hm.getUrlMap().get("/static/**");
177-
assertThat(staticHandler).extracting("locationValues").asList().hasSize(2);
176+
assertThat(staticHandler).extracting("locationValues").asList().hasSize(4);
178177
});
179178
}
180179

spring-boot-project/spring-boot-autoconfigure/src/test/resources/META-INF/resources/webjars/webjar

Whitespace-only changes.

spring-boot-project/spring-boot-dependencies/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,7 @@ bom {
16631663
]
16641664
}
16651665
}
1666-
library("Spring Framework", "5.3.11") {
1666+
library("Spring Framework", "5.3.12-SNAPSHOT") {
16671667
group("org.springframework") {
16681668
imports = [
16691669
"spring-framework-bom"

0 commit comments

Comments
 (0)