1

I'm about to extend org.springframework.context.support.AbstractMessageSource that will allow me to dynamically add and edit messages in Spring. I'm planning on storing these values in a database. Is there something out there that does this already? Is there a different approach I should think of?

Here are the requirements:

  • I have to be able to add messages
  • I have to be able to edit messages
  • These adds and edits should take place immediately
three-cups
  • 4,375
  • 3
  • 31
  • 41

1 Answers1

1

Sure.

Develop custom MessageSource and set it as parent to existing (for example based on property files).

    <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
    <property name="basenames">
        <list>
            <value>message/messages</value>
        </list>
    </property>

    <property name="parentMessageSource">
        <bean class=com.example.DatabaseMessageSource"/>
    </property>
</bean>
alex.b
  • 1,448
  • 19
  • 23