mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
02af3e7a17
Traditionally, AbstractResourceBasedMessageSource has only had a setDefaultEncoding() method which accepts the name of the default encoding character set. However, although we have recently made a concerted effort within the framework to introduce support for supplying a Charset instead of a character set's name, we had overlooked this particular scenario. In light of that, this commit introduces setDefaultCharset(Charset) and getDefaultCharset() methods in AbstractResourceBasedMessageSource and makes direct use of the available Charset in ReloadableResourceBundleMessageSource and ResourceBundleMessageSource. Furthermore, although technically a regression in behavior, invoking setDefaultEncoding() on such MessageSource implementations with an invalid character set name now results in an immediate UnsupportedCharsetException at configuration time instead of a NoSuchMessageException at runtime, which will help users to more easily detect misconfiguration. Closes gh-36413