| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?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:cache="http://www.springframework.org/schema/cache"
- 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-4.0.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
- http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-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/cache http://www.springframework.org/schema/cache/spring-cache-4.0.xsd">
-
- <context:component-scan base-package="com.goafanti.*.service;com.goafanti.*.*.service" />
-
- <bean id="log-filter" class="com.alibaba.druid.filter.logging.Log4jFilter">
- <property name="resultSetLogEnabled" value="true" />
- </bean>
-
- <bean id="idGenerator" class="com.goafanti.core.mybatis.JDBCIdGenerator"></bean>
-
- <bean name="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
- <property name="url" value="${jdbc.url}" />
- <property name="username" value="${jdbc.username}" />
- <property name="password" value="${jdbc.password}" />
- <property name="initialSize" value="${jdbc.initialSize}" />
- <property name="minIdle" value="${jdbc.minIdle}" />
- <property name="maxActive" value="${jdbc.maxActive}" />
- <property name="maxWait" value="${jdbc.maxWait}" />
- <property name="timeBetweenEvictionRunsMillis" value="${jdbc.timeBetweenEvictionRunsMillis}" />
- <property name="minEvictableIdleTimeMillis" value="${jdbc.minEvictableIdleTimeMillis}" />
- <property name="validationQuery" value="${jdbc.validationQuery}" />
- <property name="testWhileIdle" value="${jdbc.testWhileIdle}" />
- <property name="testOnBorrow" value="${jdbc.testOnBorrow}" />
- <property name="testOnReturn" value="${jdbc.testOnReturn}" />
- <property name="removeAbandoned" value="${jdbc.removeAbandoned}" />
- <property name="removeAbandonedTimeout" value="${jdbc.removeAbandonedTimeout}" />
- <property name="logAbandoned" value="${jdbc.logAbandoned}" />
- <property name="filters" value="${jdbc.filters}" />
- <property name="proxyFilters">
- <list>
- <ref bean="log-filter"/>
- </list>
- </property>
- </bean>
- <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
- <property name="dataSource" ref="dataSource" />
- <property name="configLocation" value="classpath:mybatis-config.xml"/>
- <property name="mapperLocations" >
- <list>
- <value>classpath:com/goafanti/common/mapper/*.xml</value>
- </list>
- </property>
- </bean>
-
- <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
- <constructor-arg index="0" ref="sqlSessionFactory" />
- </bean>
- <bean id="baseMybatisDao" class="com.goafanti.core.mybatis.BaseMybatisDao" >
- <property name="sqlSessionFactory" ref="sqlSessionFactory" />
- </bean>
- <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
- <property name="basePackage" value="com.goafanti.common.dao" />
- <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
- </bean>
- <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
- <property name="dataSource" ref="dataSource" />
- </bean>
-
- <tx:advice id="txAdvice" transaction-manager="transactionManager">
- <tx:attributes>
- <tx:method name="publish*" rollback-for="Exception" />
- <tx:method name="save*" rollback-for="Exception" />
- <tx:method name="push*" rollback-for="Exception" />
- <tx:method name="add*" rollback-for="Exception" />
- <tx:method name="update*" rollback-for="Exception" />
- <tx:method name="insert*" rollback-for="Exception" />
- <tx:method name="create*" rollback-for="Exception" />
- <tx:method name="batch*" rollback-for="Exception" />
- <tx:method name="del*" rollback-for="Exception" />
- <tx:method name="init*" rollback-for="Exception" />
- <tx:method name="bind*" rollback-for="Exception" />
- <tx:method name="*" read-only="true" />
- </tx:attributes>
- </tx:advice>
-
- <aop:config proxy-target-class="true">
- <aop:pointcut id="myPointcut" expression="execution(* com.goafanti.*.service..*.*(..))" />
- <aop:advisor advice-ref="txAdvice" pointcut-ref="myPointcut" />
- </aop:config>
-
- <cache:annotation-driven />
-
- </beans>
|