---
title: "spring configure a java.util.Properties"
author: "wangdf_jee"
date: "2011-11-24T18:28:15Z"
tags: []
categories: ["企业架构"]
slug: "spring-configure-a-java-util-properties"
draft: false
lastmod: "2011-11-24T18:39:26Z"
id: 1277063
url: "https://wangdf-jee.iteye.com/blog/1277063"
---

```

<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>


```