<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<!-- 数据源-->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="com.mysql.jdbc.Driver"></property>
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/one"></property>
<property name="user" value="root"></property>
<property name="password" value="admin123"></property>
</bean>
<!-- 配置Spring整合mybatis框架的SqlSessionFactoryBean-->
<bean id="MySqlSeeeionFactoryBean" class="org.mybatis.spring.SqlSessionFactoryBean">
<!-- 引入数据源-->
<property name="dataSource" ref="dataSource"></property>
<!-- 扫描实体类包,批量创建别名-->
<property name="typeAliasesPackage" value="com.domain"></property>
</bean>
<!-- mapper扫描器,对相对应的映射文件进行扫描-->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.mapper"></property>
</bean>
</beans>