本文共 1419 字,大约阅读时间需要 4 分钟。
<?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>
本文转自 兴趣e族 51CTO博客,原文链接:http://blog.51cto.com/simplelife/1695782
转载地址:http://sabux.baihongyu.com/