一.mysql数据库引入

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3306/seckill?useUnicode=true&characterEncoding=utf8" />
<property name="user" value="root" />
<property name="password" value="123456" />

<!--c3po连接池的私有属性 -->
<property name="maxPoolSize" value="30" /><!--数据库连接池最大的连接对象 -->
<property name="minPoolSize" value="10" /><!--数据库连接池最小的连接对象 -->
<property name="autoCommitOnClose" value="false" /><!--关闭连接后不自动commit -->
<property name="checkoutTimeout" value="10000" /><!--数据库连接池最大连接池的等待时间
默认0,无限等待 -->
<property name="acquireRetryAttempts" value="20" /><!--获取连接失败时尝试获取次数 -->
</bean>

mysql  jar文件依赖

<!--二:数据库相关依赖 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.35</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.2.1</version>
</dependency>

spring 配置文件 数据库引入的更多相关文章

  1. Spring依赖注入的方式、类型、Bean的作用域、自动注入、在Spring配置文件中引入属性文件

    1.Spring依赖注入的方式 通过set方法完成依赖注入 通过构造方法完成依赖注入 2.依赖注入的类型 基本数据类型和字符串 使用value属性 如果是指向另一个对象的引入 使用ref属性 User ...

  2. 在spring配置文件中引入外部properties配置文件 context:property-placeholder

    在spring的配置文件中,有时我们需要注入很多属性值,这些属性全都写在spring的配置文件中的话,后期管理起来会非常麻烦.所以我们可以把某一类的属性抽取到一个外部配置文件中,使用时通用spring ...

  3. Spring 源码(4)在Spring配置文件中自定义标签如何实现?

    Spring 配置文件自定义标签的前置条件 在上一篇文章https://www.cnblogs.com/redwinter/p/16165274.html Spring BeanFactory的创建过 ...

  4. spring配置文件引入properties文件:<context:property-placeholder>标签使用总结

    一.问题描述: 1.有些参数在某些阶段中是常量,比如: (1)在开发阶段我们连接数据库时的连接url.username.password.driverClass等 (2)分布式应用中client端访问 ...

  5. SPRING IN ACTION 第4版笔记-第二章WIRING BEANS-008-在Java配置文件中引入xml配置文件@Import、@ImportResource

    1. package soundsystem; import org.springframework.beans.factory.annotation.Autowired; public class ...

  6. Spring配置文件引入xml文件: <import resource=" " />标签使用总结

    引入其他模块XML 在Spring的配置文件,有时候为了分模块的更加清晰的进行相关实体类的配置. 比如现在有一个job-timer.xml的配置 <?xml version="1.0& ...

  7. Spring配置文件中未引入dubbo命名空间头部配置而引起的错误案例

    问题描述: Spring配置文件中未引入dubbo命名空间的头部配置而引起项目启动时报出如下错误信息: org.springframework.beans.factory.xml.XmlBeanDef ...

  8. springBoot2.0使用@ImportResource引入spring配置文件.xml

    1. 编写spring配置文件.xml 这里是bean.xml <?xml version="1.0" encoding="UTF-8"?> < ...

  9. Spring配置文件外部化配置及.properties的通用方法

    摘要:本文深入探讨了配置化文件(即.properties)的普遍应用方式.包括了Spring.一般的.远程的三种使用方案. 关键词:.properties, Spring, Disconf, Java ...

随机推荐

  1. 转:CString::GetLength()获得字节数的正确方法

    前段时间,做http协议上传文件及断点续传控件时,在客户端采用C++调用CHttpConnection.CHttpFile进行文件上传.移植到Unicode编码时,上传得到的文件总是小于正常文件.最终 ...

  2. ural 1052 Rabbit Hunt

    http://acm.timus.ru/problem.aspx?space=1&num=1052 #include <cstdio> #include <cstring&g ...

  3. css设置水平垂直居中

    关于CSS设置水平以及垂直居中的解决方案 想要水平居中? 内联的元素(文字)? .center-children { text-align: center;} 块级元素? .center-me { m ...

  4. ChangeServiceConfig2 function

    ChangeServiceConfig2 function   Changes the optional configuration parameters of a service. Syntax C ...

  5. 设计模式(十二): Flyweight享元模式 -- 结构型模式

    说明: 相对于其它模式,Flyweight模式在PHP实现似乎没有太大的意义,因为PHP的生命周期就在一个请求,请求执行完了,php占用的资源都被释放.我们只是为了学习而简单做了介绍. 1. 概述 面 ...

  6. cf509A Maximum in Table

    A. Maximum in Table time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  7. Windows服务器Pyton辅助运维--01.自动Copy文件(文件夹)到远程服务器所在目录

    Windows服务器Pyton辅助运维 01.自动Copy文件(文件夹)到远程服务器所在目录 开发环境: u  Web服务器: Windows Server 2008 R2 SP1 IIS 7.5 u ...

  8. HDU_2057——64位无符号16进制数的运算

    Problem Description There must be many A + B problems in our HDOJ , now a new one is coming. Give yo ...

  9. MYSQL存储过程,清除指前缀的定表名的数据

    MYSQL存储过程,清除指前缀的定表名的数据 DELIMITER $$ DROP PROCEDURE IF EXISTS `drop_table`$$ ),)) BEGIN ) DEFAULT NUL ...

  10. mongoose--------ORM数据操作框架

    数据关系映射:ORM O:object R:relation M:mapping 把对数据库的操作都封装到对象中,操作了对象,就相当于操作了数据库. 安装: npm install mongoose ...