Results 1 to 2 of 2

Thread: wildcards in resource locations?

Hybrid View

  1. #1
    Join Date
    Sep 2008
    Posts
    1

    Default 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. #2
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •