国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

spring和mybatis整合配置

2019-11-15 00:33:02
字體:
來源:轉載
供稿:網友
sPRing和mybatis整合配置
<?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:p="http://www.springframework.org/schema/p"xmlns:context="http://www.springframework.org/schema/context"xmlns:mvc="http://www.springframework.org/schema/mvc"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-4.1.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-4.1.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd"><!--開啟自動掃描  --><context:component-scan base-package="com.pb.zte"/><!--引入JDBC配置文件  --><bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"><property name="location" value="classpath:jdbc.properties"/></bean><!--數據源  --><bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"><!--驅動  --><property name="driverClassName" value="${driver}"/><!--URL  --><property name="url" value="${url}"/><!--username  --><property name="username" value="${username}"/><!--passWord  --><property name="password" value="${password}"/></bean><!--sqlsessionFactory  spring和MyBatis完美整合,不需要mybatis的配置映射文件--><bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"><!--注入數據源  --><property name="dataSource" ref="dataSource"/><!--掃描所有Dao的實現類xml 自動掃描mapping.xml文件--><property name="mapperLocations" value="classpath:com/pb/zte/mapping/*.xml"/></bean><!--為所有DAO層注入sqlSessionFactory  --><bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"><!--基本包Dao層所在包最上一層  --><property name="basePackage" value="com.pb.zte.mapper"/><!--注入sqlSessionFactoryBeanName  --><property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property></bean><!--數據源事務管理  --><bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><!--注入數據源  --><property name="dataSource" ref="dataSource"/></bean></beans>


上一篇:接口限流

下一篇:java中的clone

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 大新县| 金寨县| 大田县| 汝城县| 自贡市| 德化县| 天门市| 南安市| 民乐县| 济阳县| 门源| 大同市| 临桂县| 营山县| 曲水县| 淮阳县| 枣庄市| 搜索| 镇雄县| 盐津县| 远安县| 元谋县| 普定县| 布拖县| 哈尔滨市| 平谷区| 胶州市| 郸城县| 随州市| 鱼台县| 平凉市| 苍梧县| 吉隆县| 安阳县| 绩溪县| 英吉沙县| 淳化县| 循化| 黑山县| 九龙坡区| 新巴尔虎右旗|