Announcement Announcement Module
Collapse
No announcement yet.
wildcards in resource locations? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • wildcards in resource locations?

    Hi,

    I have declared a messageSource bean as follows (note: the resource bundles are *outside* my webapp's classpath and need to stay that way):

    <bean id="messageSource" class="org.springframework.context.support.Reloada bleResourceBundleMessageSource">
    <property name="basenames">
    <list>
    <value>foo/bar-1/BaseName</value>
    <value>foo/bar-2/BaseName</value>
    <value>foo/bar-3/BaseName</value>
    <value>foo/bar-4/BaseName</value>
    </list>
    </property>
    </bean>

    The above is working fine. However, if possible, I would prefer to trim this configuration down with a wildcard in the path, as follows:

    <bean id="messageSource" class="org.springframework.context.support.Reloada bleResourceBundleMessageSource">
    <property name="basenames">
    <list>
    <value>foo/bar-*/BaseName</value>
    </list>
    </property>
    </bean>

    Or even:

    <bean id="messageSource" class="org.springframework.context.support.Reloada bleResourceBundleMessageSource">
    <property name="basenames">
    <list>
    <value>foo/**/BaseName</value>
    </list>
    </property>
    </bean>

    I've tried both of these wildcard configurations (and some other alternatives) but I don't seem to using the correct syntax, since the bundles are never resolved. Could someone please clue me in on the correct syntax? Note: I've tried prefixing the file protocol ("file:", "file:/", "file://", even "file:///") but that didn't do the trick...

    Thanks!

  • #2
    ReloadableResourceBundleMessageSource doesn't offer ability you mentioned out of the box. However, it's open-sourced, so, you can wrap it a little in order to scan resource files via standard spring resource resolution.

    Comment

    Working...
    X