spring+mybatis配置

mybatis配置部分:

<?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:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-3.1.xsd ">

	<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"
		p:typeAliasesPackage="com.xxx.model.pojo"
		p:dataSource-ref="dataSource" p:configLocation="classpath:mybatis/mybatisConfig.xml"
		p:mapperLocations="classpath:mybatis/sqlMap/*.xml">
	</bean>

	<bean class="org.mybatis.spring.SqlSessionTemplate">
		<constructor-arg ref="sqlSessionFactory" />
	</bean>

	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"
		p:sqlSessionFactoryBeanName="sqlSessionFactory" p:basePackage="com.xxx.dao" />

</beans>

 

 

你可能感兴趣的:(mybatis)