Skip to content

Commit 9d6a0cf

Browse files
committed
Starting building against Spring Framework 5.3.12 snapshots
This reverts commit 3969e63, reversing changes made to f01d086. Closes gh-28385 See gh-28252
1 parent 9e203cb commit 9d6a0cf

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
import java.util.function.Supplier;
2321

2422
import org.apache.commons.logging.Log;
@@ -53,7 +51,6 @@
5351
import org.springframework.context.annotation.Import;
5452
import org.springframework.core.Ordered;
5553
import org.springframework.core.annotation.Order;
56-
import org.springframework.core.io.ResourceLoader;
5754
import org.springframework.format.FormatterRegistry;
5855
import org.springframework.format.support.FormattingConversionService;
5956
import org.springframework.http.codec.ServerCodecConfigurer;
@@ -156,21 +153,18 @@ public static class WebFluxConfig implements WebFluxConfigurer {
156153

157154
private final ObjectProvider<ViewResolver> viewResolvers;
158155

159-
private final ResourceLoader resourceLoader;
160-
161156
public WebFluxConfig(WebProperties webProperties, WebFluxProperties webFluxProperties,
162157
ListableBeanFactory beanFactory, ObjectProvider<HandlerMethodArgumentResolver> resolvers,
163158
ObjectProvider<CodecCustomizer> codecCustomizers,
164159
ObjectProvider<ResourceHandlerRegistrationCustomizer> resourceHandlerRegistrationCustomizer,
165-
ObjectProvider<ViewResolver> viewResolvers, ResourceLoader resourceLoader) {
160+
ObjectProvider<ViewResolver> viewResolvers) {
166161
this.resourceProperties = webProperties.getResources();
167162
this.webFluxProperties = webFluxProperties;
168163
this.beanFactory = beanFactory;
169164
this.argumentResolvers = resolvers;
170165
this.codecCustomizers = codecCustomizers;
171166
this.resourceHandlerRegistrationCustomizer = resourceHandlerRegistrationCustomizer.getIfAvailable();
172167
this.viewResolvers = viewResolvers;
173-
this.resourceLoader = resourceLoader;
174168
}
175169

176170
@Override
@@ -190,28 +184,17 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) {
190184
return;
191185
}
192186
if (!registry.hasMappingForPattern("/webjars/**")) {
193-
String webjarsLocation = "classpath:/META-INF/resources/webjars/";
194-
if (this.resourceLoader.getResource(webjarsLocation).exists()) {
195-
ResourceHandlerRegistration registration = registry.addResourceHandler("/webjars/**")
196-
.addResourceLocations(webjarsLocation);
197-
configureResourceCaching(registration);
198-
customizeResourceHandlerRegistration(registration);
199-
}
187+
ResourceHandlerRegistration registration = registry.addResourceHandler("/webjars/**")
188+
.addResourceLocations("classpath:/META-INF/resources/webjars/");
189+
configureResourceCaching(registration);
190+
customizeResourceHandlerRegistration(registration);
200191
}
201192
String staticPathPattern = this.webFluxProperties.getStaticPathPattern();
202193
if (!registry.hasMappingForPattern(staticPathPattern)) {
203-
List<String> foundLocations = new ArrayList<>();
204-
for (String staticLocation : this.resourceProperties.getStaticLocations()) {
205-
if (this.resourceLoader.getResource(staticLocation).exists()) {
206-
foundLocations.add(staticLocation);
207-
}
208-
}
209-
if (!foundLocations.isEmpty()) {
210-
ResourceHandlerRegistration registration = registry.addResourceHandler(staticPathPattern)
211-
.addResourceLocations(foundLocations.toArray(new String[0]));
212-
configureResourceCaching(registration);
213-
customizeResourceHandlerRegistration(registration);
214-
}
194+
ResourceHandlerRegistration registration = registry.addResourceHandler(staticPathPattern)
195+
.addResourceLocations(this.resourceProperties.getStaticLocations());
196+
configureResourceCaching(registration);
197+
customizeResourceHandlerRegistration(registration);
215198
}
216199
}
217200

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
@@ -204,23 +204,20 @@ public static class WebMvcAutoConfigurationAdapter implements WebMvcConfigurer,
204204

205205
private final ResourceHandlerRegistrationCustomizer resourceHandlerRegistrationCustomizer;
206206

207-
private final ResourceLoader resourceLoader;
208-
209207
private ServletContext servletContext;
210208

211209
public WebMvcAutoConfigurationAdapter(WebProperties webProperties, WebMvcProperties mvcProperties,
212210
ListableBeanFactory beanFactory, ObjectProvider<HttpMessageConverters> messageConvertersProvider,
213211
ObjectProvider<ResourceHandlerRegistrationCustomizer> resourceHandlerRegistrationCustomizerProvider,
214212
ObjectProvider<DispatcherServletPath> dispatcherServletPath,
215-
ObjectProvider<ServletRegistrationBean<?>> servletRegistrations, ResourceLoader resourceLoader) {
213+
ObjectProvider<ServletRegistrationBean<?>> servletRegistrations) {
216214
this.resourceProperties = webProperties.getResources();
217215
this.mvcProperties = mvcProperties;
218216
this.beanFactory = beanFactory;
219217
this.messageConvertersProvider = messageConvertersProvider;
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
@@ -160,10 +160,9 @@ void shouldRegisterResourceHandlerMapping() {
160160
SimpleUrlHandlerMapping hm = context.getBean("resourceHandlerMapping", SimpleUrlHandlerMapping.class);
161161
assertThat(hm.getUrlMap().get("/**")).isInstanceOf(ResourceWebHandler.class);
162162
ResourceWebHandler staticHandler = (ResourceWebHandler) hm.getUrlMap().get("/**");
163-
assertThat(staticHandler).extracting("locationValues").asList().hasSize(2);
164-
assertThat(staticHandler.getLocations()).hasSize(2);
165-
assertThat(staticHandler.getLocations().get(0)).hasToString("class path resource [META-INF/resources/]");
166-
assertThat(staticHandler.getLocations().get(1)).hasToString("class path resource [public/]");
163+
assertThat(staticHandler).extracting("locationValues").asList().hasSize(4);
164+
assertThat(staticHandler.getLocations()).hasSize(1);
165+
assertThat(staticHandler.getLocations().get(0)).hasToString("class path resource [public/]");
167166
assertThat(hm.getUrlMap().get("/webjars/**")).isInstanceOf(ResourceWebHandler.class);
168167
ResourceWebHandler webjarsHandler = (ResourceWebHandler) hm.getUrlMap().get("/webjars/**");
169168
assertThat(webjarsHandler).extracting("locationValues").asList()
@@ -177,7 +176,7 @@ void shouldMapResourcesToCustomPath() {
177176
SimpleUrlHandlerMapping hm = context.getBean("resourceHandlerMapping", SimpleUrlHandlerMapping.class);
178177
assertThat(hm.getUrlMap().get("/static/**")).isInstanceOf(ResourceWebHandler.class);
179178
ResourceWebHandler staticHandler = (ResourceWebHandler) hm.getUrlMap().get("/static/**");
180-
assertThat(staticHandler).extracting("locationValues").asList().hasSize(2);
179+
assertThat(staticHandler).extracting("locationValues").asList().hasSize(4);
181180
});
182181
}
183182

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
@@ -1642,7 +1642,7 @@ bom {
16421642
]
16431643
}
16441644
}
1645-
library("Spring Framework", "5.3.11") {
1645+
library("Spring Framework", "5.3.12-SNAPSHOT") {
16461646
group("org.springframework") {
16471647
imports = [
16481648
"spring-framework-bom"

0 commit comments

Comments
 (0)