java属性文件未在Unix计算机上加载,但在windows计算机上也在加载。不明白为什么?
我将Spring4.3.6和Tomcat7用于我们的web应用程序。我的xml文件中有以下配置:-
<bean id="appResourcesProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value>classpath*:resources\xxxxxxResources.properties</value>
</list>
</property>
</bean>
这在windows计算机上运行得很好,但在unix计算机上部署相同的时,没有加载属性文件
然后我删除了类路径后面的“*”,并修改如下:-
<bean id="appResourcesProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value>classpath:resources\WCApplicationResources.properties</value>
</list>
</property>
</bean>
这在unix机器上运行良好。为什么会这样?我不明白原因。谁能帮我理解这一点。提前感谢
# 1 楼答案
getResources发现如下内容:
希望对你有所帮助
# 2 楼答案
原因是“\”,请尝试使用“/”,如
resources/WCApplicationResources.properties