<?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" xsi:schemaLocation ="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.1.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/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 ="DeptDaoMapper" class ="org.mybatis.spring.mapper.MapperFactoryBean" > <property name ="mapperInterface" value ="org.dao.IDeptDao" > </property > <property name ="sqlSessionFactory" ref ="sqlSessionFactory" > </property > </bean > <context:component-scan base-package ="org.service,org.dao,org.dao.impl,org.service.impl" > </context:component-scan >
</beans >