Start building against Spring Framework 5.3.0 snapshots
See gh-21929
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -128,7 +128,8 @@ public final class StaticResourceRequest {
|
||||
}
|
||||
|
||||
private Stream<String> getPatterns() {
|
||||
return this.locations.stream().flatMap(StaticResourceLocation::getPatterns);
|
||||
return this.locations.stream().flatMap(StaticResourceLocation::getPatterns)
|
||||
.map((pattern) -> pattern.replace("/**/", "/*/"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -284,18 +284,6 @@ public class WebMvcAutoConfiguration {
|
||||
return resolver;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(prefix = "spring.mvc", name = "locale")
|
||||
public LocaleResolver localeResolver() {
|
||||
if (this.mvcProperties.getLocaleResolver() == WebMvcProperties.LocaleResolver.FIXED) {
|
||||
return new FixedLocaleResolver(this.mvcProperties.getLocale());
|
||||
}
|
||||
AcceptHeaderLocaleResolver localeResolver = new AcceptHeaderLocaleResolver();
|
||||
localeResolver.setDefaultLocale(this.mvcProperties.getLocale());
|
||||
return localeResolver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageCodesResolver getMessageCodesResolver() {
|
||||
if (this.mvcProperties.getMessageCodesResolverFormat() != null) {
|
||||
@@ -420,6 +408,19 @@ public class WebMvcAutoConfiguration {
|
||||
return welcomePageHandlerMapping;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(prefix = "spring.mvc", name = "locale", matchIfMissing = true)
|
||||
public LocaleResolver localeResolver() {
|
||||
if (this.mvcProperties.getLocaleResolver() == WebMvcProperties.LocaleResolver.FIXED) {
|
||||
return new FixedLocaleResolver(this.mvcProperties.getLocale());
|
||||
}
|
||||
AcceptHeaderLocaleResolver localeResolver = new AcceptHeaderLocaleResolver();
|
||||
localeResolver.setDefaultLocale(this.mvcProperties.getLocale());
|
||||
return localeResolver;
|
||||
}
|
||||
|
||||
private Optional<Resource> getWelcomePage() {
|
||||
String[] locations = getResourceLocations(this.resourceProperties.getStaticLocations());
|
||||
return Arrays.stream(locations).map(this::getIndexHtml).filter(this::isReadable).findFirst();
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.boot.web.codec.CodecCustomizer;
|
||||
import org.springframework.boot.web.reactive.function.client.WebClientCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.client.reactive.ClientHttpConnector;
|
||||
import org.springframework.http.client.reactive.ClientHttpResponse;
|
||||
@@ -87,6 +88,7 @@ class WebClientAutoConfigurationTests {
|
||||
void shouldGetPrototypeScopedBean() {
|
||||
this.contextRunner.withUserConfiguration(WebClientCustomizerConfig.class).run((context) -> {
|
||||
ClientHttpResponse response = mock(ClientHttpResponse.class);
|
||||
given(response.getHeaders()).willReturn(new HttpHeaders());
|
||||
ClientHttpConnector firstConnector = mock(ClientHttpConnector.class);
|
||||
given(firstConnector.connect(any(), any(), any())).willReturn(Mono.just(response));
|
||||
WebClient.Builder firstBuilder = context.getBean(WebClient.Builder.class);
|
||||
|
||||
@@ -277,8 +277,12 @@ class WebMvcAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void noLocaleResolver() {
|
||||
this.contextRunner.run((context) -> assertThat(context).doesNotHaveBean(LocaleResolver.class));
|
||||
void defaultLocaleResolver() {
|
||||
this.contextRunner.run((context) -> {
|
||||
assertThat(context).hasSingleBean(LocaleResolver.class);
|
||||
LocaleResolver localeResolver = context.getBean(LocaleResolver.class);
|
||||
assertThat(((AcceptHeaderLocaleResolver) localeResolver).getDefaultLocale()).isNull();
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user