Skip to content

Commit 971bdd3

Browse files
committed
Start building against Framework 5.3.12 snapshots
This reverts commit b32a38a. See gh-28223 Closes gh-28369
1 parent 6c45878 commit 971bdd3

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;
@@ -51,7 +49,6 @@
5149
import org.springframework.context.annotation.Configuration;
5250
import org.springframework.context.annotation.Import;
5351
import org.springframework.core.Ordered;
54-
import org.springframework.core.io.ResourceLoader;
5552
import org.springframework.format.FormatterRegistry;
5653
import org.springframework.format.support.FormattingConversionService;
5754
import org.springframework.http.codec.ServerCodecConfigurer;
@@ -154,14 +151,12 @@ public static class WebFluxConfig implements WebFluxConfigurer {
154151

155152
private final ObjectProvider<ViewResolver> viewResolvers;
156153

157-
private final ResourceLoader resourceLoader;
158-
159154
public WebFluxConfig(org.springframework.boot.autoconfigure.web.ResourceProperties resourceProperties,
160155
WebProperties webProperties, WebFluxProperties webFluxProperties, ListableBeanFactory beanFactory,
161156
ObjectProvider<HandlerMethodArgumentResolver> resolvers,
162157
ObjectProvider<CodecCustomizer> codecCustomizers,
163158
ObjectProvider<ResourceHandlerRegistrationCustomizer> resourceHandlerRegistrationCustomizer,
164-
ObjectProvider<ViewResolver> viewResolvers, ResourceLoader resourceLoader) {
159+
ObjectProvider<ViewResolver> viewResolvers) {
165160
this.resourceProperties = resourceProperties.hasBeenCustomized() ? resourceProperties
166161
: webProperties.getResources();
167162
this.webFluxProperties = webFluxProperties;
@@ -170,7 +165,6 @@ public WebFluxConfig(org.springframework.boot.autoconfigure.web.ResourceProperti
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
@@ -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
@@ -150,10 +150,9 @@ void shouldRegisterResourceHandlerMapping() {
150150
SimpleUrlHandlerMapping hm = context.getBean("resourceHandlerMapping", SimpleUrlHandlerMapping.class);
151151
assertThat(hm.getUrlMap().get("/**")).isInstanceOf(ResourceWebHandler.class);
152152
ResourceWebHandler staticHandler = (ResourceWebHandler) hm.getUrlMap().get("/**");
153-
assertThat(staticHandler).extracting("locationValues").asList().hasSize(2);
154-
assertThat(staticHandler.getLocations()).hasSize(2);
155-
assertThat(staticHandler.getLocations().get(0)).hasToString("class path resource [META-INF/resources/]");
156-
assertThat(staticHandler.getLocations().get(1)).hasToString("class path resource [public/]");
153+
assertThat(staticHandler).extracting("locationValues").asList().hasSize(4);
154+
assertThat(staticHandler.getLocations()).hasSize(1);
155+
assertThat(staticHandler.getLocations().get(0)).hasToString("class path resource [public/]");
157156
assertThat(hm.getUrlMap().get("/webjars/**")).isInstanceOf(ResourceWebHandler.class);
158157
ResourceWebHandler webjarsHandler = (ResourceWebHandler) hm.getUrlMap().get("/webjars/**");
159158
assertThat(webjarsHandler).extracting("locationValues").asList()
@@ -167,7 +166,7 @@ void shouldMapResourcesToCustomPath() {
167166
SimpleUrlHandlerMapping hm = context.getBean("resourceHandlerMapping", SimpleUrlHandlerMapping.class);
168167
assertThat(hm.getUrlMap().get("/static/**")).isInstanceOf(ResourceWebHandler.class);
169168
ResourceWebHandler staticHandler = (ResourceWebHandler) hm.getUrlMap().get("/static/**");
170-
assertThat(staticHandler).extracting("locationValues").asList().hasSize(2);
169+
assertThat(staticHandler).extracting("locationValues").asList().hasSize(4);
171170
});
172171
}
173172

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
@@ -1578,7 +1578,7 @@ bom {
15781578
]
15791579
}
15801580
}
1581-
library("Spring Framework", "5.3.11") {
1581+
library("Spring Framework", "5.3.12-SNAPSHOT") {
15821582
group("org.springframework") {
15831583
imports = [
15841584
"spring-framework-bom"

0 commit comments

Comments
 (0)