spring configure a java.util.Properties

<bean id="mappings"  class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
 <!-- typed as a java.util.Properties -->
 <property name="properties">
    <value>
        jdbc.driver.className=com.mysql.jdbc.Driver
        jdbc.url=jdbc:mysql://localhost:3306/mydb
    </value>
 </property>
</bean>

<bean id="mappings"  class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
 <!-- typed as a java.util.Properties -->
 <property name="location">
    <value>
   datasource.properties
    </value>
 </property>
</bean>


<bean id="mappings"  class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
 <!-- typed as a java.util.Properties -->
  <property name="locations">
               <list>
                   <value>/WEB-INF/jdbc.properties</value>
               </list>
           </property>
</bean>

猜你喜欢

转载自wangdf-jee.iteye.com/blog/1277063
今日推荐