但這裡想要強調的是Resource Bundle Search Order,官方文件說明如下:
Resource bundles are searched in the following order:在程式開發的時候,一開始為了避免同時修改properties可能會盡量從ActionClass.properties做起,但隨著系統開發過程應該將公用的部分逐漸往search order下方移,又或是在SA / SD階段就整理出已確定會公用的部分,直接一開始就寫在package.properties甚至是global resource properties裡面,但不管如何,這些properties的整理雖然很繁瑣,但卻不可忽視。
- ActionClass.properties
- Interface.properties (every interface and sub-interface)
- BaseClass.properties (all the way to Object.properties)
- ModelDriven's model (if implements ModelDriven), for the model object repeat from 1
- package.properties (of the directory where class is located and every parent directory all the way to the root directory)
- search up the i18n message key hierarchy itself
- global resource properties