Java Reference
In-Depth Information
<bean id="cashier1" class="">
<property name="name" value="cashier1" />
<property name="path" value="c:/cashier" />
Or you can simply include the <context:annotation-config> element in your bean configuration file
and a CommonAnnotationBeanPostProcessor instance will automatically get registered. But before this tag
can work, you must add the context schema definition to your <beans> root element.
<beans xmlns=""
<context:annotation-config />
1-8. Resolving Text Messages
For an application to support internationalization (I18N for short because there are 18 characters
between the first character, i , and the last character, n ), it requires the capability of resolving text
messages for different locales.
Spring's application context can resolve text messages for a target locale by their keys. Typically, the
messages for one locale should be stored in one separate properties file. This properties file is called a
resource bundle .
MessageSource is an interface that defines several methods for resolving messages. The
ApplicationContext interface extends this interface so that all application contexts can resolve text
messages. An application context delegates the message resolution to a bean with the exact name
messageSource . ResourceBundleMessageSource is the most common MessageSource implementation that
resolves messages from resource bundles for different locales.
How It Works
As an example, you can create the following resource bundle, , for the
English language in the United States. Resource bundles will be loaded from the root of the classpath.
alert.checkout=A shopping cart has been checked out.
To resolve messages from resource bundles, you use ResourceBundleMessageSource as
your MessageSource implementation. This bean's name must be set to messageSource for the
Search WWH ::

Custom Search