Spring配置文件读取Properties属性文件
1. jdbc.properties
jdbc.driverClass=com.mysql.jdbc.Driverjdbc.url=jdbc:mysql://127.0.0.1/mkey3gdb2?useUnicode=true&characterEncoding=utf-8&autoReconnect=truejdbc.username=rootjdbc.password=123hibernate.dialect=org.hibernate.dialect.MySQL5Dialecthibernate.show_sql=false
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"><beans default-merge="true"> <bean id="propertyConfigurer" destroy-method="close" abstract="false" lazy-init="default" autowire="default" dependency-check="default"><property name="driverClass"><value>${jdbc.driverClass}</value></property><property name="jdbcUrl"><value>${jdbc.url}</value></property><property name="user"><value>${jdbc.username}</value></property><property name="password"><value>${jdbc.password}</value></property><property name="minPoolSize"><value>10</value></property><property name="maxPoolSize"><value>20</value></property><property name="initialPoolSize"><value>10</value></property><property name="idleConnectionTestPeriod" ><value>50</value></property></bean> </beans>
<context-param><param-name>contextConfigLocation</param-name><param-value>/WEB-INF/classes/applicationContext*.xml</param-value></context-param>
<listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>