class LocaleArgumentResolver implements ArgumentResolver {

    @Override
    public Optional<Object> resolve(ArgumentResolverContext input) {
        if (input.parameterTypeEquals(Locale.class)) {
            return Optional.of(Locale.forLanguageTag(input.unwrapRequest().getLocale()));
        }
        return Optional.empty();
    }

}