<?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:context="http://www.springframework.org/schema/context"
|
xmlns:tx="http://www.springframework.org/schema/tx"
|
xmlns:aop="http://www.springframework.org/schema/aop"
|
xmlns:cache="http://www.springframework.org/schema/cache"
|
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.0.xsd
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
|
|
<context:component-scan base-package="cn.com.basic.face.discern.component">
|
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
|
</context:component-scan>
|
|
<!-- 加载外部属性配置文件 -->
|
<context:property-placeholder location="classpath:/db.properties"/>
|
|
<!-- 配置数据源 -->
|
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
|
<!-- <property name="driverClassName" value="${db.driver}" /> -->
|
<property name="url" value="${db.url}" />
|
<property name="username" value="${db.username}" />
|
<property name="password" value="${db.password}" />
|
<!-- <property name="maxActive" value="10" /> -->
|
<!-- <property name="maxIdle" value="5" /> -->
|
</bean>
|
|
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
<property name="dataSource" ref="dataSource"/>
|
<property name="configLocation" value="classpath:/mybatis/SqlMapConfig.xml"/>
|
</bean>
|
|
<bean id="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
<property name="basePackage" value="cn.com.basic.face.discern.baseApi.mapper"/>
|
</bean>
|
|
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
<property name="dataSource" ref="dataSource"/>
|
</bean>
|
|
<aop:config>
|
<aop:pointcut expression="execution(* *..*Service.*(..))" id="txPointcut"/>
|
<aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut" order="50"/>
|
</aop:config>
|
|
<tx:advice id="txAdvice" transaction-manager="transactionManager">
|
<tx:attributes>
|
<tx:method name="query*" read-only="true"/>
|
</tx:attributes>
|
</tx:advice>
|
|
</beans>
|