spring-dao.xml
来源:互联网 发布:mac触摸板怎么用 编辑:程序博客网 时间:2024/06/11 00:12
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <!--配置整合mybatis过程--> <!--1:配置数据库相关参数--> <context:property-placeholder location="classpath:jdbc.properties"/> <!--2.数据库连接池--> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <!--配置连接池属性--> <property name="driverClass" value="${jdbc.driver}"/> <property name="jdbcUrl" value="${jdbc.url}"/> <property name="user" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> <!--c3p0连接池的私有属性--> <property name="maxPoolSize" value="30"/> <property name="minPoolSize" value="10"/> <!--关闭连接不自动commit--> <property name="autoCommitOnClose" value="false"/> <!--获取连接超时时间--> <property name="checkoutTimeout" value="3000"/> <!--当获取链接失败重试次数--> <property name="acquireRetryAttempts" value="2"/> </bean> <!--3.配置SqlSessionFactory对象--> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <!--注入数据库连接池--> <property name="dataSource" ref="dataSource"/> <!--配置mybatis全局配置文件--> <property name="configLocation" value="classpath:mybatis-config.xml"/> <!--扫描entity包 使用别名 可以简化书写 多个包时用;隔开--> <property name="typeAliasesPackage" value="org.seckill.entity"/> <!--扫描sql配置文件:mapper需要的xml文件--> <property name="mapperLocations" value="classpath:mapper/*.xml"/> </bean> <!--4.配置扫描Dao接口包,动态实现dao接口,注入到spring容器中--> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <!--注入sqlSessionFactory--> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/> <!--给出需要扫描dao接口包--> <property name="basePackage" value="dao包名"/> </bean></beans>
#c3po配置jdbc.driver=com.mysql.jdbc.Driverjdbc.url=jdbc:mysql://localhost:3306/seckill?userUnicode=true&characterEncoding=utf8jdbc.username=rootjdbc.password=root
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"><configuration> <!--配置全局属性--> <settings> <!--使用JDBC的getGeneratedKeys获取数据库自增主键值--> <setting name="useGeneratedKeys" value="true"/> <!--使用列别名替换列名 默认为true--> <setting name="useColumnLabel" value="true"/> <!--开启驼峰命名转换 Table(create_time) -> Entity(createTime)--> <setting name="mapUnderscoreToCamelCase" value="true"/> </settings></configuration>
0 0
- spring-dao.xml
- Spring DAO
- spring Dao
- Spring DAO
- spring DAO
- Spring DAO
- 第2.1.3章 WEB系统最佳实践Spring文件配置之spring-dao.xml
- applicationContext-dao.xml
- Springmvc之dao.xml
- applicationContext-dao.xml
- 用spring组织DAO
- Spring DAO之JDBC
- Spring中的DAO
- Spring Dao层设计
- spring 管理DAO
- 用spring组织DAO
- spring DAO体系结构
- Spring DAO支持
- Oracle用户创建及赋权
- spring-web.xml
- spring-service.xml
- 【23种设计模式从零学2—简单工厂与工厂模式】
- ubuntu terminal及vim使用solarized主题教程
- spring-dao.xml
- java注解
- 安卓小菜鸟重拾Java系列002.Java转义字符与与sax解析xml
- 多行文字溢出解决方案
- java编程思想读书笔记(四)
- django学习9 数据库操作命令
- 打印螺旋队列(更简单的方法)(难度:1颗星)
- hdu1005
- OJ题-营救公主