首页 > 数据库技术 > 详细

SpringMVC配置数据库连接池

时间:2016-01-08 23:27:02      阅读:492      评论:0      收藏:0      [点我收藏+]

http://www.cnblogs.com/coqn/archive/2012/08/15/SpringMvc%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA%E9%85%8D%E7%BD%AE.html

SpringMvc环境搭建(配置文件)

 

spring配置:context:property-placeholder 读取配置文件信息 在配置文件中使用el表达式填充值

spring将properties文件读取后在配置文件中直接将对象的配置信息填充到bean中的变量里。

原本使用PropertyPlaceholderConfigurer类进行文件信息配置。 PropertyPlaceholderConfigurer实现了BeanFactoryPostProcessor接口,能够 对<bean/>中的属性值进行外在化管理。
<bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  <property name="locations">
    <list>
      <value>userinfo.properties</value>
    </list>
  </property>
</bean>
<bean name="userInfo" class="test.UserInfo">
  <property name="username" value="${db.username}"/>
  <property name="password" value="${db.password}"/>
</bean>

现在,直接使用
<context:property-placeholder location="classpath*:resources/*.properties" />

注意:spring容器中最多只能定义一个context:property-placeholder。

分类: spring
 
不知道这个对不对,先记录下来

SpringMVC配置数据库连接池

原文:http://www.cnblogs.com/rocky-AGE-24/p/5115067.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!