當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
Spring AOP在事务中的应用典范
生活随笔
收集整理的這篇文章主要介紹了
Spring AOP在事务中的应用典范
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<?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:tx="http://www.springframework.org/schema/tx"xmlns:aop="http://www.springframework.org/schema/aop"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"><bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close" autowire="no"><property name="url" value="jdbc:mysql://localhost:3306/mytest?serverTimezone=UTC"></property><property name="username" value="root"></property><property name="password" value="operater"></property><property name="driverClassName" value="com.mysql.cj.jdbc.Driver"></property><property name="minIdle" value="1"/><property name="maxIdle" value="5"/><property name="maxActive" value="100"/><property name="initialSize" value="1"/><property name="testOnBorrow" value="true"/><property name="validationQuery" value="select 1"/><property name="testOnReturn" value="true"/><property name="validationInterval" value="500000"/><property name="removeAbandoned" value="true"/><property name="removeAbandonedTimeout" value="30"/><property name="fairQueue" value="false"/><property name="defaultAutoCommit" value="false"/></bean><bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><property name="dataSource" ref="dataSource"/></bean><bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"><property name="dataSource" ref="dataSource"></property></bean><bean id="studentDao" class="com.leon.spring.dao.impl.StudentDaoImpl"><property name="jdbcTemplate" ref="jdbcTemplate"/></bean><bean id="studentService" class="com.leon.spring.service.impl.StudentServiceImpl"><property name="studentDao" ref="studentDao"/></bean><bean id="studentServiceProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"><property name="transactionManager" ref="transactionManager" /><property name="target" ref="studentService"/><property name="transactionAttributes"><props><prop key="save*">PROPAGATION_REQUIRED</prop><prop key="update*">PROPAGATION_REQUIRED</prop><prop key="remove*">PROPAGATION_REQUIRED</prop><prop key="get*">PROPAGATION_REQUIRED,readOnly</prop></props></property></bean></beans>
?
總結
以上是生活随笔為你收集整理的Spring AOP在事务中的应用典范的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Spring 的创建流程
- 下一篇: Java动态代理生成的对象导出方法