Announcement Announcement Module
Collapse
No announcement yet.
Managing .properties for a Common web component Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Managing .properties for a Common web component

    Hello,

    Currently Im working on an application that is using version 1.2.8 of core spring (ye, I know its quite old but not allowed to upgrade just yet).

    I have a multi-component web project ie. 3 wars and 1 common library.

    The problem Im facing is how to lookup war-specific properties in the common library component.

    a simple example to illustrate the point:

    war-01
    |
    war01.properties (name=Sarah)
    SomeController01.class

    war-02
    |
    war02.properties (name=Tara)
    SomeController02.class

    common
    |
    Helper.class

    Lets say the controllers both use Helper.class which needs to lookup a property called 'name' from some.properties. How best to design the management of the property files such that the Helper looks up the 'name' property from the appropriate bundle in a generic way?

    At the moment the solution is really messy and not using Spring's facilities for managing resource bundles.

    Can I use ResourceBundleMessageSource or ReloadableResourceBundleMessageSource somehow to manage this?

    If I did this is each war configuration, Im not sure how to manage the lookup of the different basename in a generic way. Can anyone help?

    Code:
    <beans>
    <bean id="messageSource"
    class="org.springframework.context.support.ResourceBundleMessageSource">
    <property name="basenames">
    <list>
    <value>war01</value>
    </list>
    </property>
    </bean>
    </beans>
    
    <beans>
    <bean id="messageSource"
    class="org.springframework.context.support.ResourceBundleMessageSource">
    <property name="basenames">
    <list>
    <value>war02</value>
    </list>
    </property>
    </bean>
    </beans>
Working...
X