2011-08-25 129 views
0
 <bean id="ssoSessionFactory" 
      class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> 
      <property name="configLocation"> 
       <value>classpath:sso-hibernate.cfg.xml</value> 
      </property> 
      <property name="configurationClass"> 
       <value>org.hibernate.cfg.AnnotationConfiguration</value> 
      </property> 
this is the part im unsure of.... 
<property name="configfile"> 
       <value>classpath:sso-hibernate.properties</value> 
      </property> 
     </bean> 

我知道有至少有六种方法来做到这一点,但为了我的需要,这将是最简单的。什么是将指定哪个hibernate.properties文件使用的属性的语法?原因是这个应用程序可能最终会有大约5或6个同步数据库连接,并且它们必须位于不同的文件中。这是什么正确的语法

回答

0

我相信你正在寻找the hibernateProperties property,它允许你在工厂bean中设置一个Properties实例。由于春天的PropertyEditors的魔力,你可以只写

<property name="hibernateProperties" value="classpath:sso-hibernate.properties"/> 
0

他们是使用hibernet.properties在answer on coderanch

这是一个很好的例子是声明的豆

<bean id="hibernateConfigProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> 
    <property name="location"> 
     <value>classpath:hibernate.properties</value> 
    </property> 
</bean>