spring-mybatis整合xml配置
2017-12-12 19:22
260 查看
<?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-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd "> <!-- 配置数据源 这里用的是dbcp连接池的数据源--> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"></property> <property name="url"> <value>jdbc:mysql://127.0.0.1:3306/smbms?useUnicode=true&characterEncoding=utf-8</value> </property> <property name="username" value="root"></property> <property name="password" value="wenwen"></property> </bean> <!-- 配置sqlSessionFactoryBean --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <!-- 配置数据源 --> <property name="dataSource" ref="dataSource"></property> <!-- 引用Mybatis配置文件中的配置 --> <property name="configLocation"> <value>classpath:mybatis-config.xml</value> </property> <!-- 配置SQL映射文件 --> <property name="mapperLocations"> <list> <value>classpath:com/chen/mapping/*.xml</value> </list> </property> </bean> <!-- 配置扫描dao --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.chen.mapping"></property> </bean> <!-- 注解自动扫包 --> <context:component-scan base-package="com.chen.serviceImpl,com.chen.mapping"> </context:component-scan> </beans>
相关文章推荐
- SSM Spring +SpringMVC+Mybatis 整合配置 及pom.xml
- springboot整合mybatis注解版与XML配置版
- springMVC+MyBatis+meaven整合的pom.xml配置文件
- springMVC+mybatis整合之applicationContext.xml基本配置详解
- Spring+Spring Mvc+Mybatis+MySqlite(SSM框架整合Xml配置)
- mybatis-spring 的整合_配置application.xml
- spring、mybatis整合核心配置文件applicationContext.xml
- spring-mybatis.xml配置文件,spring与mybatis整合在一起
- 【Spring】XML配置整合Mybatis
- spring+Mybatis+Ehcache整合(Ehcachec参数说明XML配置)
- SSM(spring-springmvc-mybatis)整合开发xml配置文件内容springmvc-config.xml,application.xml,web.xml
- MyBatis Spring整合配置映射接口类与映射xml文件
- Spring、MyBatis的整合数据映射器类(UserMapper->iocContext.xml)配置文件详解
- 整合SpringMVC+Spring+Mybatis+mysql的maven配置文件pom.xml
- springMVC+MyBatis+meaven整合的pom.xml配置文件
- Spring+Mybatis整合配置xml
- MyBatis Spring整合配置映射接口类与映射xml文件
- spring和mybatis整合 sqlMapConfig.xml配置文件
- spring和myBatis整合,springIOC.xml的配置文件
- spring+springMVC+mybatis整合示例(基于XML配置文件)