2013-03-23 24 views
0

我有一个名为fc-jsf的项目。该项目的spring上下文引用fc-bus项目中名为Beans.xml的其他spring上下文。我有fc-bus作为fc-jsf的项目依赖项。如何从spring applicationContext到达其他项目的资源?

我导入beans.xml中是这样的:

<import resource="classpath*:com/fc/spring/Beans.xml" /> 

它的工作,但它说,FC-JSF项目不能看到的beans.xml声明的属性:

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
     <property name="location"> 
      <value>com/fc/properties/database.properties</value> 
     </property> 
    </bean> 

唯一的例外是:

SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener 
org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/com/fc/properties/database.properties] 

如何到达database.properties不复制的属性文件到FC-JSF p roject?

编辑:theese是maven项目,database.properties位于fc-bus - > src/main/resurces/com/fc文件夹中。

回答

0

尝试使用像

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
    <property name="location"> 
     <value>classpath:com/fc/properties/database.properties</value> 
    </property> 
</bean> 

的属性,否则不知道哪个包应该使用它从

+0

工作就像一个魅力试试!谢谢! – adam0404 2013-03-23 14:12:16

0

<value>classpath*:database.properties</value>

相关问题