如何在java中使用spring可重新加载消息资源中的远程位置属性文件

如何在java中使用spring可重新加载消息资源中的远程位置属性文件,java,spring,tomcat,spring-mvc,Java,Spring,Tomcat,Spring Mvc,我有一个分布式系统,上面有8个运行tomcat的应用服务器。这是一个spring应用程序。我想使用一个属性文件,它将位于其他一些服务器上,而所有tomcat只从那里读取它。 我正在使用ReloadableResourceBundleMessageSource来使用自动刷新功能。 我的bean定义是 <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessa

我有一个分布式系统,上面有8个运行tomcat的应用服务器。这是一个spring应用程序。我想使用一个属性文件,它将位于其他一些服务器上,而所有tomcat只从那里读取它。 我正在使用ReloadableResourceBundleMessageSource来使用自动刷新功能。 我的bean定义是

<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">  
          <property name="basenames" >
            <list>
                <value>file:///192.168.1.10//var/rateLimit</value> 
             </list>
        </property>
        <property name="cacheSeconds" value="60"></property>  
</bean>  
我无法使用此ip地址加载文件


您能帮我一下吗。

这是我通过HTTP读取外部属性文件的方法:

<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    <property name="basenames" value="/WEB-INF/messages,http://our.server.org/ws/i18n"/>
    <property name="cacheSeconds" value="300"/>
    <property name="useCodeAsDefaultMessage" value="true"/>
</bean>


也许将文件URI封装在带引号的字符串中会有所帮助?

file:///192.168.1.10//var/rateLimit 你在浏览器中检查过那个链接吗?是的,我检查过我可以在浏览器中打开它亲爱的,你能给我一个建议吗?把这个文件保存在远程位置读取属性时会对应用程序的性能产生影响。如果将
cacheSeconds
设置为-1,则它将永久缓存文件。因此,它只会在启动时加载文件一次,并且不会影响性能。您可能希望将其设置为某个长值,以便进行更改(如每天)。嗯,这意味着如果我每隔24小时加载一次文件,那么这段时间之间将没有http连接。每个应用服务器都将缓存文件,并且不会与远程服务器通信。是这样吗?
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    <property name="basenames" value="/WEB-INF/messages,http://our.server.org/ws/i18n"/>
    <property name="cacheSeconds" value="300"/>
    <property name="useCodeAsDefaultMessage" value="true"/>
</bean>