<?xml
version="1.0"
encoding="UTF⑻"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans⑶.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc⑶.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context⑶.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop⑶.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx⑶.0.xsd ">
<context:component-scan
base-package="com.rl"/>
<bean
id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property
name="driverClassName"
value="com.mysql.jdbc.Driver"></property>
<"url"
"jdbc:mysql://localhost:3306/mybatis"></"username"
"root"></"password"
"123456"></property>
</bean>
<!--
使用spring来管理sqlSessionFactory
-->
<"sqlSessionFactory"
"org.mybatis.spring.SqlSessionFactoryBean">
<"configLocation"
"classpath:sqlMapConfig.xml"></ref="dataSource"></bean>
<"txManager"
"org.springframework.jdbc.datasource.DataSourceTransactionManager">
<tx:advice
"txAdvice"
transaction-manager="txManager">
<tx:attributes>
<tx:method
"save*"
propagation="REQUIRED"/>
<"update*"
"delete*"
"select*"
read-only="true"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:advisor
advice-ref=pointcut="execution(* com.rl.service..*.*(..))"/>
</aop:config>
</beans>
|