title: How to ask hibernate don't read the "hibernate.properties" in classpath via spring configuration
body: <p>There is a "hibernate.properties" file in classpath which is shared by some tools, so I can't remove it.</p>
  
  <p>But I want to create a "hibernate.test.properties" for testing, whose content is different from "hibernate.properties".</p>
  
  <p>Then I configure the spring:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://www.springframework.org/schema/tx
          http://www.springframework.org/schema/tx/spring-tx-3.0.xsd  
          http://www.springframework.org/schema/aop  
          http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context-3.0.xsd
          http://www.springframework.org/schema/mvc
          http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"&gt;
  
      &lt;context:component-scan base-package="com.test" /&gt;
  
      &lt;tx:annotation-driven transaction-manager="transactionManager"
          proxy-target-class="true" /&gt;
  
      &lt;bean
          class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
          &lt;property name="location"&gt;
              &lt;value&gt;classpath:hibernate.test.properties&lt;/value&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="dataSource"
          class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
          &lt;property name="driverClassName" value="${hibernate.connection.driver_class}" /&gt;
          &lt;property name="url" value="${hibernate.connection.url}" /&gt;
          &lt;property name="username" value="${hibernate.connection.username}" /&gt;
          &lt;property name="password" value="${hibernate.connection.password}" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="hibernateProps"
          class="org.springframework.beans.factory.config.PropertiesFactoryBean"&gt;
          &lt;property name="properties"&gt;
              &lt;props&gt;
                  &lt;prop key="hibernate.hbm2ddl.auto"&gt;${hibernate.hbm2ddl.auto}&lt;/prop&gt;
                  &lt;prop key="hibernate.dialect"&gt;${hibernate.dialect}&lt;/prop&gt;
                  &lt;prop key="hibernate.show_sql"&gt;${hibernate.show_sql}&lt;/prop&gt;
                  &lt;prop key="hibernate.c3p0.minPoolSize"&gt;${hibernate.c3p0.minPoolSize}&lt;/prop&gt;
                  &lt;prop key="hibernate.c3p0.maxPoolSize"&gt;${hibernate.c3p0.maxPoolSize}&lt;/prop&gt;
                  &lt;prop key="hibernate.c3p0.idleTestPeriod"&gt;${hibernate.c3p0.idleTestPeriod}s&lt;/prop&gt;
                  &lt;prop key="hibernate.c3p0.timeout"&gt;${hibernate.c3p0.timeout}&lt;/prop&gt;
                  &lt;prop key="hibernate.c3p0.max_statement"&gt;${hibernate.c3p0.max_statement}&lt;/prop&gt;
                  &lt;prop key="hibernate.c3p0.testConnectionOnCheckout"&gt;${hibernate.c3p0.testConnectionOnCheckout}&lt;/prop&gt;
                  &lt;prop key="hibernate.c3p0.preferredTestQuery"&gt;${hibernate.c3p0.preferredTestQuery}&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="transactionManager"
          class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;
          &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="sessionFactory"
          class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
          &lt;property name="hibernateProperties" ref="hibernateProps" /&gt;
          &lt;property name="packagesToScan" value="com.test.pojo" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"&gt;
          &lt;constructor-arg ref="sessionFactory" /&gt;
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>But I found although I specified new properties in this file, hibernate will still read the properties from "hibernate.properties" and override them. So I always get a wrong connection.</p>
  
  <p>Is there any way to fix it?</p>