<?xml version= "1.0" encoding= "UTF-8"?>
<beans xmlns= "Http://www.springframework.org/schema/beans"
xmlns:context= "Http://www.springframework.org/schema/context"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xmlns:aop= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"
xmlns:tx= "Http://www.springframework.org/schema/tx" xmlns:p= "http://www.springframework.org/schema/p"
Xmlns:util= "Http://www.springframework.org/schema/util" xmlns:jdbc= "Http://www.springframework.org/schema/jdbc"
Xmlns:cache= "Http://www.springframework.org/schema/cache"
Xsi:schemalocation= "
Http://www.springframework.org/schema/context
Http://www.springframework.org/schema/context/spring-context.xsd
Http://www.springframework.org/schema/beans
Http://www.springframework.org/schema/beans/spring-beans.xsd
Http://www.springframework.org/schema/tx
Http://www.springframework.org/schema/tx/spring-tx.xsd
Http://www.springframework.org/schema/jdbc
Http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
Http://www.springframework.org/schema/cache
Http://www.springframework.org/schema/cache/spring-cache-3.1.xsd
Http://www.springframework.org/schema/aop
Http://www.springframework.org/schema/aop/spring-aop.xsd
Http://www.springframework.org/schema/util
Http://www.springframework.org/schema/util/spring-util.xsd ">
<!--automatically scanned--
<context:component-scan base-package= "Com.exayong" >
<context:exclude-filter type= "Annotation"
expression= "Org.springframework.stereotype.Controller"/>
</context:component-scan>
<!--configuration enables spring to use the Cglib agent--
<aop:aspectj-autoproxy proxy-target-class= "true"/>
<!--enable support for transaction annotations--
<tx:annotation-driven transaction-manager= "TransactionManager"
Proxy-target-class= "true"/>
<!--transaction management of DataSource data sources--
<bean id= "TransactionManager"
Class= "Org.springframework.jdbc.datasource.DataSourceTransactionManager"
p:datasource-ref= "DataSource"/>
<!--dataSource Configuration--
<bean id= "DataSource" class= "Com.alibaba.druid.pool.DruidDataSource"
Init-method= "Init" destroy-method= "Close" >
<property name= "Driverclassname" >
<value>com.mysql.jdbc.Driver</value>
</property>
<!--basic property URL, user, password--
<property name= "url" value= "Jdbc:mysql://localhost:3306/arc1?useunicode=true&characterencoding=utf-8" />
<property name= "username" value= "root"/>
<property name= "password" value= ""/>
<!--configuration initialization size, MIN, max--
<property name= "InitialSize" value= "1"/>
<property name= "Minidle" value= "1"/>
<property name= "maxactive" value= "/>"
<!--configuration Gets the time that the connection waits timeout--
<property name= "maxwait" value= "60000"/>
< how long!--configuration interval to detect idle connections that need to be closed, in milliseconds-and
<property name= "Timebetweenevictionrunsmillis" value= "60000"/>
<!--Configure the minimum time for a connection to survive in a pool, in milliseconds--
<property name= "Minevictableidletimemillis" value= "300000"/>
<property name= "Validationquery" value= "select ' X '"/>
<property name= "Testwhileidle" value= "true"/>
<property name= "Testonborrow" value= "false"/>
<property name= "Testonreturn" value= "false"/>
<!--open Pscache and specify the size of Pscache on each connection-
<property name= "Poolpreparedstatements" value= "false"/>
<property name= "Maxpoolpreparedstatementperconnectionsize"
Value= "/>"
<!--configuration monitoring statistics intercept filters--
<property name= "Filters" value= "stat"/>
</bean>
<!--mybatis file configuration, scan all mapper files--
<bean id= "Sqlsessionfactory" class= "Org.mybatis.spring.SqlSessionFactoryBean"
p:datasource-ref= "DataSource" p:configlocation= "Classpath:mybatis-config.xml"
p:mapperlocations= "Classpath:com/exayong/**/*mapper.xml"/>
<!--spring and MyBatis are configured to scan all DAO automatically for @Repository to be swept
<bean class= "Org.mybatis.spring.mapper.MapperScannerConfigurer"
P:basepackage= "Com.exayong"
P:annotationclass= "Org.springframework.stereotype.Repository"
/>
</beans>
Spring Configuration Applicationcontext.xml