<?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/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- 定义Mybatis的SqlSessionFactory -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!-- 定义数据源 -->
<property name="dataSource" ref="dataSource" />
<!-- 指定calsspath下mybatis全局配置文件 -->
<property name="configLocation" value="classpath:mybatis/mybatis-config.xml"></property>
<!-- 扫描mappers目录以及子目录下的所有xml文件 -->
<!-- <property name="mapperLocations" value="classpath:mybatis/mappers/**/*.xml" /> -->
<!-- 别名扫描包 -->
<property name="typeAliasesPackage" value="com.simple.sso.pojo"/>
</bean>
<!-- 定义Mapper接口扫描器:让其自动生成接口的代理实现类 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.simple.sso.mapper" />
</bean>
</beans>
配置系列:ssm中applicationContext-mybatis.xml的简单配置
原文地址:http://simplelife.blog.51cto.com/9954761/1695782