2014-02-19 35 views
0

我試圖建立在Tomcat的一對夫婦的webapps,但沒有屬性的文件越來越拿起無法打開性質在文件中的Spring Web應用程序

2014-02-19 15:47:02,106 - WARN org.springframework.core.io.support.PropertiesLoaderSupport - Could not load properties from class 
path resource [indexing.properties]: class path resource [indexing.properties] cannot be opened because it does not exist 
2014-02-19 15:47:02,110 - WARN org.springframework.core.io.support.PropertiesLoaderSupport - Could not load properties from class 
path resource [user-service.properties]: class path resource [user-service.properties] cannot be opened because it does not exist 
2014-02-19 15:47:05,169 - WARN com.cubeia.backoffice.users.Configuration - No user-service.properties configuration file found. U 
sing default. 

的/ WEB-INF /班/服務。 xml文件有以下定義:

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
    <property name="locations"> 
     <list> 
      <value>classpath:default-indexing.properties</value> 
      <value>classpath:indexing.properties</value> 
     </list> 
    </property> 
    <property name="ignoreResourceNotFound" value="true" /> 
</bean> 

我試過複製.property文件無處不在我能想到的。 tomcat/conf,tomcat/lib,tomcat/conf/Catalina,tomcat/conf/catalina/localhost,webapps // WEB-INF /,webapps // WEB-INF/classes /,然後也在同一個目錄下用實際的。類文件,臨時目錄,你的名字。只是不會撿起來。

後來編輯:我也嘗試過類似/ WEB-INF/classes,WEB-INF /,tomcat/conf,tomcat/lib,classpath *:......基本上所有可能的組合。

+0

試試刪除類路徑:值標記 – Naren

+0

只需嘗試刪除classpath:在值標記中並將您的屬性文件保存在彈出配置xml存在的文件夾中 – Naren

回答

1

你應該把你的屬性文件在你的webapp的src/main/resources目錄下。 Maven(我假設你正在使用maven)會將這個文件複製到你的WEB-INF/classes目錄中,並放到你的類路徑中。如果你按照@arahant的答案,一切都會好起來的。

0

classpath:點到WEB-INF/classes中

如果您正在使用Spring MVC 3,你可以使用util:properties註解。以下是工作配置的摘錄。

<util:properties id="emailProperties" location="classpath:../email.properties"/> 

這裏我email.properties是在WEB-INF目錄,因此../文件名前

的util的模式出現在http://www.springframework.org/schema/util/spring-util-3.0.xsd

相關問題