<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http:///schema/beans"
xmlns:xsi="http:///2001/XMLSchema-instance"
xmlns:p="http:///schema/p"
xmlns:context="http:///schema/context"
xsi:schemaLocation="http:///schema/beans
http:///schema/beans/spring-beans-3.1.xsd
http:///schema/context
http:///schema/context/spring-context-3.1.xsd">
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="url" value="jdbc:mysql://localhost:3306/testdb"></property>
<property name="username" value="root"></property>
<property name="password" value="123"></property>
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="configLocation" value="classpath:mybatis-config.xml"></property>
<property name="typeAliasesPackage" value="org.entity"></property>
</bean>
<bean id="empMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="org.dao.IEmpMapper"/>
<property name="sqlSessionFactory" ref="sqlSessionFactory"/>
</bean>
<bean id="deptMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="org.dao.IDeptMapper"/>
<property name="sqlSessionFactory" ref="sqlSessionFactory"/>
</bean>
<context:component-scan
base-package="org.dao,org.dao.impl,org.service,org.service.impl"/>
</beans>