<?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:aop= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"
Xmlns:jdbc= "Http://www.springframework.org/schema/jdbc"
xmlns:p= "http://www.springframework.org/schema/p"
xmlns:tx= "Http://www.springframework.org/schema/tx"
Xmlns:mvc= "Http://www.springframework.org/schema/mvc"
xmlns:context= "Http://www.springframework.org/schema/context"
xsi:schemalocation= "Http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/ Spring-jdbc-4.3.xsd
Http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
Http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
Http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd ">
<context:annotation-config></context:annotation-config>
<context:component-scan base-package= "com" ></context:component-scan>
<bean id= "DataSource" class= "Com.mchange.v2.c3p0.ComboPooledDataSource" >
<property name= "Driverclass" value= "Com.mysql.jdbc.Driver" ></property>
<property name= "Jdbcurl" value= "jdbc:mysql:///spring" ></property>
<property name= "User" value= "root" ></property>
<property name= "password" value= "123" ></property>
<property name= "Minpoolsize" value= "ten" ></property>
<property name= "maxpoolsize" value= "></property>"
</bean>
<bean id= "TransactionManager" class= "Org.springframework.jdbc.datasource.DataSourceTransactionManager" >
<property name= "DataSource" ref= "DataSource" ></property>
</bean>
<bean id= "Sqlsessionfactory" class= "Org.mybatis.spring.SqlSessionFactoryBean" >
<property name= "DataSource" ref= "DataSource" ></property>
</bean>
<!--<bean id= "Factorybean" class= "Org.mybatis.spring.mapper.MapperFactoryBean" >
<property name= "Mapperinterface" value= "Com.test.UserMapper" ></property>
<property name= "Sqlsessionfactory" ref= "Sqlsessionfactory" ></property>
</bean>
<!--all mapper interfaces under the scan package--
<bean id= "Factorybean" class= "Org.mybatis.spring.mapper.MapperScannerConfigurer" >
<property name= "Basepackage" value= "Com.test" ></property>
<property name= "Sqlsessionfactory" ref= "Sqlsessionfactory" ></property>
</bean>
<!--Configure declarative transactions--
<tx:advice id= "Txadvice" transaction-manager= "TransactionManager" >
<!--<tx:attributes>
<tx:method name= "*" propagation= "REQUIRED" read-only= "true"/>
</tx:attributes>
</tx:advice>
<aop:config >
<aop:pointcut expression= "Execution (* com.test.test.* (..))" id= "Mypointcut"/>
<aop:advisor advice-ref= "Txadvice" pointcut-ref= "Mypointcut"/>
</aop:config>
</beans>
Mybaties's Applicationcontext.xml