spring整合jdbc的配置资料.pdfVIP

  • 3
  • 0
  • 约9.78千字
  • 约 7页
  • 2021-11-21 发布于福建
  • 举报
Spring+jdbc springContext.xml 在 src 目录下新建一个名为 springContext.xml 内容如下: ?xml version =1.0 encoding =UTF-8 ? beans xmlns =/schema/beans xmlns:xsi = /2001/XMLSchema-instance xmlns:context =/schema/context xmlns:tx =/schema/tx xsi:schemaLocation =/schema/beans /schema/beans/spring-beans-3.0.xsd /schema/context /schema/context/spring-context-3.0.xsd /schema/tx /schema/tx/spring-tx-3.0.xsd !-- 配置数据源 -- bean id =dataSource class =mons.dbcp.BasicDataSource destroy-method =close property name =driverClassName value =com.mysql.jdbc.Driver / property name =url value =jdbc:mysql://localhost:3306/fl / property name =username value =root / property name =password value =P@ssw0rd / !-- 连接池启动时的初始值 -- property name =initialSize value =1 / !-- 连接池的最大值 -- property name =maxActive value =500 / !-- 最大空闲值,当经过一个高峰时间后,连接池可以慢慢将已经用不到的连接释放,一直减少到 msxIdle 为止 -- property name =maxIdle value =2 / !-- 最小空闲值, 当空闲的连接数小于阀值时, 连接池就会预申请一些连接, 以免洪峰到来时来不及申 请 -- property name =minIdle value =1 / / bean !-- 配置事务管理器 -- bean id =txManager class = org.springframework.jdbc.datasource.DataSourceTransactionManager property name =dataSource ref =dataSource / / bean !-- 采用@Transactional 注解方式使用事务 -- tx:an

文档评论(0)

1亿VIP精品文档

相关文档