Honor overriden AccepptHeaderLocaleContextResolver.getDefaultLocale()

This commit is contained in:
Lars Grefer 2020-04-06 16:10:41 +02:00 committed by Juergen Hoeller
parent e1951a098b
commit 8682a5d89a
1 changed files with 3 additions and 2 deletions

View File

@ -98,7 +98,7 @@ public class AcceptHeaderLocaleContextResolver implements LocaleContextResolver
@Nullable @Nullable
private Locale resolveSupportedLocale(@Nullable List<Locale> requestLocales) { private Locale resolveSupportedLocale(@Nullable List<Locale> requestLocales) {
if (CollectionUtils.isEmpty(requestLocales)) { if (CollectionUtils.isEmpty(requestLocales)) {
return this.defaultLocale; // may be null return getDefaultLocale(); // may be null
} }
List<Locale> supportedLocales = getSupportedLocales(); List<Locale> supportedLocales = getSupportedLocales();
if (supportedLocales.isEmpty()) { if (supportedLocales.isEmpty()) {
@ -128,7 +128,8 @@ public class AcceptHeaderLocaleContextResolver implements LocaleContextResolver
return languageMatch; return languageMatch;
} }
return (this.defaultLocale != null ? this.defaultLocale : requestLocales.get(0)); final Locale defaultLocale = getDefaultLocale();
return (defaultLocale != null ? defaultLocale : requestLocales.get(0));
} }
@Override @Override