<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<context:property-placeholder location="db.properties"/>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.driver}"></property>
<property name="url" value="${jdbc.url}"></property>
<property name="username" value="${jdbc.username}"></property>
<property name="password" value="${jdbc.password}"></property>
</bean>
<bean id="factory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="configLocation" value="mybatis-config.xml"></property>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.woniuxy.mapper"></property>
<property name="sqlSessionFactoryBeanName" value="factory"></property>
</bean>
<bean id="userService" class="com.woniuxy.service.impl.UserServiceImpl">
<property name="userMapper" ref="userMapper"></property>
<property name="logService" ref="logService"></property>
</bean>
<bean id="logService" class="com.woniuxy.service.impl.LogServiceImpl">
<property name="logMapper" ref="logMapper"></property>
</bean>
<aop:config>
<aop:pointcut expression="execution(* com.woniuxy.service.impl.UserServiceImpl.*.*(..))" id="pc"/>
<aop:advisor advice-ref="tx_advice" pointcut-ref="pc"/>
</aop:config>
<tx:advice id="tx_advice" transaction-manager="transactionManager" >
<tx:attributes>
<tx:method name="*"/>
</tx:attributes>
</tx:advice>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
</beans>