End to end UTF-8 encoding usage with MySql and Spring – Part 2

1 min read >

End to end UTF-8 encoding usage with MySql and Spring – Part 2

Engineering Insights & Enterprise solutions

One thing I forgot to mention was the usage of Spring message bundles. Usually, a ResourceBundleMessageSource is configured to inject bundle messages for Spring MVC. The only bad thing is that I could not specify an encoding for the configured message.properties files. As the default properties format is ISO 8859-1 character encoding and tedious operations like the transformation of Unicode characters using native2ascii tool are necessary, I looked for a way to load UTF-8 resource files without any transformations. Spring has a ReloadableResourceBundleMessageSource class that allows just that, along with the reloadable behavior. The bundle configuration now looks:

<bean id=”messageSource” class=”org.springframework.context.support.ReloadableResourceBundleMessageSource”>

<property name=”basename”>



<property name=”defaultEncoding”>



<property name=”cacheSeconds”>




Unlock innovation and digital transformation for your business.

Get in touch

We are always happy to talk






165 Splaiul Unirii, Timpuri Noi Square,
TN Office 2 building, 4th floor,
District 3, Bucharest, Romania, 030134