Java 属性文件未在Unix计算机上加载,但在windows计算机上运行。不明白为什么?
我将Spring4.3.6和Tomcat7用于我们的web应用程序。我的xml文件中有以下配置:-Java 属性文件未在Unix计算机上加载,但在windows计算机上运行。不明白为什么?,java,spring-mvc,Java,Spring Mvc,我将Spring4.3.6和Tomcat7用于我们的web应用程序。我的xml文件中有以下配置:- <bean id="appResourcesProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="locations"> <list> <value>classpath*:resou
<bean id="appResourcesProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value>classpath*:resources\xxxxxxResources.properties</value>
</list>
</property>
</bean>
classpath*:resources\xxxxxxResources.properties
这在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>
classpath:resources\WCApplicationResources.properties
这在unix机器上运行良好。为什么会这样?我不明白原因。谁能帮我理解这一点。提前感谢 原因是“\”,请尝试使用“/”,如
resources/WCApplicationResources.properties
原因是“\”,请尝试使用“/”,如resources/WCApplicationResources.properties
类路径*:可移植性
通配符类路径依赖于
底层类加载器。。。。
如果返回了不适当的结果,请检查应用程序服务器文档中可能影响类加载器行为的设置
getResources发现如下内容:
The name of a resource is a '/'-separated path name that identifies the resource.
希望对你有所帮助
类路径*:可移植性
通配符类路径依赖于
底层类加载器。。。。
如果返回了不适当的结果,请检查应用程序服务器文档中可能影响类加载器行为的设置
getResources发现如下内容:
The name of a resource is a '/'-separated path name that identifies the resource.
希望它在某些方面有所帮助。如果“\”是原因,那么当我刚刚删除“*”而没有做任何其他更改时,它为什么会起作用?根据您的解释,在我将“\”更改为“/”之前,它不应该工作。如果“\”是原因,那么当我刚刚删除“*”而没有任何其他更改时,它为什么工作?根据你的解释,在我将“\”改为“/”之前,它不应该工作。