Closed
Description
adrian opened SPR-16188 and commented
I'm using Spring Boot to setup locale in spring mvc.
I'm trying to use BCP 47 for spring.mvc.locale value, but I end up with a
Property: spring.mvc.locale
Value: en-US
Reason: Failed to convert property value of type 'java.lang.String' to required type 'java.util.Locale' for property 'locale'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [java.util.Locale]
StringToLocaleConverter (relies on StringUtils.parseLocaleString) relies on _ delimiters, which is not BCP 47.
Could StringToLocaleConverter be improved to handle BCP 47 (or otherwise try both formats ?)
For BCP-47, it would correspond to calling
https://docs.oracle.com/javase/7/docs/api/java/util/Locale.html#forLanguageTag(java.lang.String)
wdyt ?
Affects: 4.3.10
Issue Links:
- BCP 47 compatible Locale support [SPR-13274] #17865 BCP 47 compatible Locale support
- Revise StringUtils.parseLocale(String) for proper handling of corner cases [SPR-16651] #21192 Revise StringUtils.parseLocale(String) for proper handling of corner cases
- CookieLocaleResolver is not RFC6265 compliant when setting a locale and time zone [SPR-16700] #21241 CookieLocaleResolver is not RFC6265 compliant when setting a locale and time zone
- ScheduledAnnotationBeanPostProcessor does not support Duration syntax [SPR-15455] #20016 ScheduledAnnotationBeanPostProcessor does not support Duration syntax
Referenced from: commits ef3f93e