Message bundle setup

First, let's set up a message bundler. The code snippet from the spring context is as follows:

    <bean id="messageSource"  class=        "org.springframework.context.support.      ReloadableResourceBundleMessageSource">       <property name="basename" value="classpath:messages" />       <property name="defaultEncoding" value="UTF-8" />     </bean>

Important points to note are as follows:

  • class="org.springframework.context.support.ReloadableResourceBundleMessageSource": We are configuring a reloadable resource bundle. Support reloading properties through the cacheSeconds setting.
  • <property name="basename" value="classpath:messages" />: Configure the loading of properties from the messages.properties and messages_{locale}.properties file. We will ...

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.