Spring-AspectJ 配置文件
<?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:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:c="http://www.springframework.org/schema/c"
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/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd"> <!--01.我们需要知道给哪个目标对象织入增强
02.需要配置目标对象
03.需要配置增强 通知-->
<!--实例化EatSleepDaoImpl-->
<bean id="eatSleepDao" class="cn.bdqn.dao.EatSleepDaoImpl"/> <!--书写多个目标对象-->
<!--实例化EatSleepServiceImpl-->
<bean id="eatSleepService" class="cn.bdqn.service.EatSleepServiceImpl">
<property name="dao" ref="eatSleepDao"></property>
</bean> <!--切面-->
<bean id="myAspect2" class="cn.bdqn.aop.aop_xml.MyAspect2"/> <!--在xml配置文件里配置aspectJ 最常用-->
<aop:config>
<!--切入点表达式 根据需求配置可以配置多个-->
<aop:pointcut id="myPointcut" expression="execution(* *..service.*.*(..))"/>
<aop:pointcut id="myPointcut2" expression="execution(* *..service.*.sleep(..))"/>
<aop:pointcut id="myPointcut2_around" expression="execution(* *..service.*.eat(..))"/>
<!--指定切面-->
<aop:aspect id="aspect2" ref="myAspect2">
<!--找到myPointcut匹配的方法进行织入-->
<aop:before method="befors" pointcut-ref="myPointcut"></aop:before> <aop:around method="around(org.aspectj.lang.ProceedingJoinPoint)" pointcut-ref="myPointcut2_around"/> <aop:after-throwing throwing="ex" method="excption(java.lang.Exception)" pointcut-ref="myPointcut"/> <aop:after-returning returning="result" method="aftersReturn(java.lang.String)" pointcut-ref="myPointcut" /> <aop:after method="afters" pointcut-ref="myPointcut2"/> </aop:aspect> </aop:config> </beans>
Spring-AspectJ 配置文件的更多相关文章
- Spring boot 配置文件详解 (properties 和yml )
从其他框架来看 我们都有自己的配置文件, hibernate有hbm,mybatis 有properties, 同样, Spring boot 也有全局配置文件. Springboot使用一个全局的配 ...
- 史上最全的Spring Boot配置文件详解
Spring Boot在工作中是用到的越来越广泛了,简单方便,有了它,效率提高不知道多少倍.Spring Boot配置文件对Spring Boot来说就是入门和基础,经常会用到,所以写下做个总结以便日 ...
- Spring AspectJ AOP 完整示例
http://outofmemory.cn/java/spring/AOP/aop-aspectj-example-before-after-AfterReturning-afterThrowing- ...
- AOP操作-AspectJ配置文件
AOP操作(AspectJ配置文件)(了解) (实际中大部分用注解方式) 1,创建两个类,增强类和被增强类,创建方法 2,在spring配置文件中创建两个类对象 3,在spring配置文件中配置切入点
- Spring的配置文件
Web.xml将会配置Spring的配置文件位置: <servlet> <servlet-name>x</servlet-name> & ...
- java Spring使用配置文件读取jdbc.properties
Spring使用配置文件读取jdbc.properties 在beans.xml中加入两个必须的bean [html]<bean id="propertyConfigurer" ...
- Spring4.0学习笔记(11) —— Spring AspectJ 的五种通知
Spring AspectJ 一.基于注解的方式配置通知 1.额外引入的jar包: a) com.springsource.org.aopalliance-1.0.0.jar b) com.sprin ...
- 使用JDom解析XML文档模拟Spring的配置文件解析
在J2EE项目中可能会涉及到一些框架的使用,最近接触到了SSH,拿Spring来说配置文件的使用是相当重要的,Spring的配置文件是一个xml文件,Spring是如何读取到配置文件并进行依赖注入的呢 ...
- Spring Boot 配置文件详解
Spring Boot配置文件详解 Spring Boot提供了两种常用的配置文件,分别是properties文件和yml文件.他们的作用都是修改Spring Boot自动配置的默认值.相对于prop ...
- Springboot 系列(二)Spring Boot 配置文件
注意:本 Spring Boot 系列文章基于 Spring Boot 版本 v2.1.1.RELEASE 进行学习分析,版本不同可能会有细微差别. 前言 不管是通过官方提供的方式获取 Spring ...
随机推荐
- 【docker 入门 - 01】- Docker 在 Centos7 上安装与测试
一.学习文档 官网网站: https://www.docker.com 中文网站:http://www.docker-cn.com 官方安装文档:https://docs.docker.com/ins ...
- python 的xlrd模块
一.安装 ♦ python官网下载http://pypi.python.org/pypi/xlrd模块安装. ♦或者在cmd窗口 pip install xlrd 二.使用 1.导入模块: imp ...
- Ubuntu16.04 修改主机名,以及解析主机名
第一步:修改主机名: vim /etc/hostname 第二步:修改网络解析名称: vim /etc/hosts 第三步:重启网络配置服务(或者刷新dns): sudo /etc/init.d/n ...
- UILabel设置富文本后不显示省略号
先描述一下问题,项目中用到了UILabel去显示一段富文本文字,超过label显示区域部分,省略号处理. 但是当设置好 attributedText 给label之后,显示出的效果是文字被切割了,并没 ...
- 微信x5内核很鸡贼啊
最近在写一个支付项目,然后要打通微信和支付宝支付,本来后端联调的时候直接调用weixin://wxpay/bizpayurl?XXXX接口就行的,完全走着通,然后到项目验收了就炸了,点不进去了,最后改 ...
- 数据结构树之AVL树(平衡二叉树)
一 什么是AVL树(平衡二叉树): AVL树本质上是一颗二叉查找树,但是它又具有以下特点:它是一棵空树或它的左右两个子树的高度差的绝对值不超过1,并且左右两个子树都是一棵平衡二叉树.在AVL树中任何节 ...
- C# DataTable抽取Distinct数据(不重复数据)[z]
DataTable dataTable; DataView dataView = dataTable.DefaultView; DataTable dataTableDisti ...
- 利用idea解决git代码冲突问题
问题描述:在开发过程中,如果你开发的代码与其他人造成冲突,在不处理的情况下会无法拉取,并且提交容易造成代码丢失: 解决方法: [此方法是同事郭富城的分享] 1,由于冲突,我们每次拉取都会失败,这时我们 ...
- 用turtle库实现汉诺塔问题~~~~~
汉诺塔问题 问题描述和背景: 汉诺塔是学习"递归"的经典入门案例,该案例来源于真实故事. ...
- java中的Condition协作线程接口类
在Java的Condition接口中,存在的几个方法跟Synchronized中的wait(),waitall(),wait(time ^),这个几个方法一一对应起来,但是在Lock.newCondi ...