基于xml配置spring的AOP
2020-03-29 13:00
344 查看
xml中主要配置
<!-- 配置账户的持久层 --> <bean id="accountDao" class="com.itheima.dao.impl.IAccountDaoImpl"> <property name="dataSource" ref="dateSource"></property> </bean> <!-- 配置账户的业务层 --> <bean id="accountService" class="com.itheima.service.impl.AccountServiceImpl"> <property name="accountDao" ref="accountDao"></property> </bean> <!-- 配置数据源 --> <bean id="dateSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver"></property> <property name="url" value="jdbc:mysql:///db20"></property> <property name="username" value="root"></property> <property name="password" value="123456"></property> </bean> <!-- spring基于xml的声明式事务控制步骤 --> <!-- 配置事务管理器 --> <bean id="transactionManger" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dateSource"></property> </bean> <!-- 配置事务 --> <tx:advice id="txAdvice" transaction-manager="transactionManger"> <tx:attributes> <tx:method name="*" propagation="REQUIRED" read-only="false"/> <tx:method name="find*" propagation="SUPPORTS" read-only="true"/> </tx:attributes> </tx:advice> <!-- 配置AOP --> <aop:config> <aop:pointcut id="pt1" expression="execution(* com.itheima.service.impl.*.*(..))"/> <!-- 建立事务通知和表达式的关系 --> <aop:advisor advice-ref="txAdvice" pointcut-ref="pt1"></aop:advisor> </aop:config>
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- 一步一步深入spring(6)--使用基于XML配置的spring实现的AOP
- Spring基于xml配置bean AOP
- spring aop的使用(注解方式以及基于xml配置方式)
- Spring基于XML配置AOP
- JavaEE--SSH--spring-AOP介绍及spring基于XML的AOP配置
- spring aop的使用(注解方式以及基于xml配置方式)
- 重温Spring之旅6——基于XML配置方式进行AOP开发
- Spring中的AOP(六)——基于XML配置文件方式的AOP
- Spring AOP - 基于XML配置文件
- 8 -- 深入使用Spring -- 4...6 AOP代理:基于注解的XML配置文件的管理方式
- spring整理(三)基于Xml的aop配置
- springAOP基于xml的配置前后环绕通知
- Spring—基于XML方式配置AOP实现通知
- Spring中的AOP(七)——基于XML配置文件方式的AOP
- Spring AOP(3)基于XML配置实现的示例
- Spring学习-22:Spring的AOP:基于AspectJ的XML配置方式开发
- Intellij IDEA创建Spring项目之基于Aspectj的AOP操作(XML配置方式)
- Spring -- 基于XML的AOP通知配置
- spring之aop编程——基于注解、xml配置文件方式
- Spring中的AOP(六)——基于XML配置文件方式的AOP