Internationalization with ReloadableResourceBundle MessageSource

1. Introduction

Internationalization (i18n) is the process of designing a software application so that it can potentially be adapted to various languages. This can be achieved with ResourceBundleMessageSource in Spring based on the locale, or ReloadableResourceBundleMessageSource which additionally allows to load the resource bundle properties on the fly explicitly or by configuring specific cacheSeconds.

2. Implementation

A bit of configuration is needed to the messageSource bean specified in the applicationContext file as –


Make sure we have added the resource bundle property files at the specified external location (E:/) as –

Internationalization with Spring

To understand the working, let’s create a MainApp class with the main method, from where we will try to access the resource bundle entry as –

3. Running the application

Running the above as java application displays as –

Internationalization with Spring - Server Console

4. Download the source code

Receive our updates to your inbox

Get more stuff like this
in your inbox

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.