1. What does FixedLocaleResolver do in Spring MVC?
Why:FixedLocaleResolver always returns the same default locale. Once it is set, it cannot be changed.
2. A FixedLocaleResolver is created and no locale is set on it. Which locale does it use?
Why: If no locale is given, FixedLocaleResolver falls back to the system's default locale, which is Locale.getDefault().
3. Besides a locale, what else can a FixedLocaleResolver optionally hold?
Why:FixedLocaleResolver always uses a default locale and, optionally, a default time zone. Neither can be changed once set.
4. Which situation is a good reason to use FixedLocaleResolver?
Why:FixedLocaleResolver is useful when you want to turn off the default AcceptHeaderLocaleResolver behavior, or when you want to switch an existing resolver to one fixed locale.
5. An app uses FixedLocaleResolver with a fixed locale of Locale.FRANCE. A user sends a request with the parameter ?lang=es to switch the language to Spanish. What happens?
Why: A fixed locale cannot be changed by the user. Every request keeps using the same locale.
6. Which line should be added after creating the resolver so that it always uses the Italian locale?
FixedLocaleResolver r =
new FixedLocaleResolver();
// add the line here
return r;
Why: The fixed locale is set with setDefaultLocale(). After that, the resolver always returns this locale.
7. Which code creates a FixedLocaleResolver that is fixed to the French locale at construction time?
Why: The fixed locale can be passed to the FixedLocaleResolver constructor. It can also be set later with setDefaultLocale().
8. A client sends a request to / with the header Accept-Language: ja-JP. What is the response body?