<?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 配置文件的更多相关文章

  1. Spring boot 配置文件详解 (properties 和yml )

    从其他框架来看 我们都有自己的配置文件, hibernate有hbm,mybatis 有properties, 同样, Spring boot 也有全局配置文件. Springboot使用一个全局的配 ...

  2. 史上最全的Spring Boot配置文件详解

    Spring Boot在工作中是用到的越来越广泛了,简单方便,有了它,效率提高不知道多少倍.Spring Boot配置文件对Spring Boot来说就是入门和基础,经常会用到,所以写下做个总结以便日 ...

  3. Spring AspectJ AOP 完整示例

    http://outofmemory.cn/java/spring/AOP/aop-aspectj-example-before-after-AfterReturning-afterThrowing- ...

  4. AOP操作-AspectJ配置文件

    AOP操作(AspectJ配置文件)(了解) (实际中大部分用注解方式) 1,创建两个类,增强类和被增强类,创建方法 2,在spring配置文件中创建两个类对象 3,在spring配置文件中配置切入点

  5. Spring的配置文件

    Web.xml将会配置Spring的配置文件位置: <servlet>        <servlet-name>x</servlet-name>        & ...

  6. java Spring使用配置文件读取jdbc.properties

    Spring使用配置文件读取jdbc.properties 在beans.xml中加入两个必须的bean [html]<bean id="propertyConfigurer" ...

  7. Spring4.0学习笔记(11) —— Spring AspectJ 的五种通知

    Spring AspectJ 一.基于注解的方式配置通知 1.额外引入的jar包: a) com.springsource.org.aopalliance-1.0.0.jar b) com.sprin ...

  8. 使用JDom解析XML文档模拟Spring的配置文件解析

    在J2EE项目中可能会涉及到一些框架的使用,最近接触到了SSH,拿Spring来说配置文件的使用是相当重要的,Spring的配置文件是一个xml文件,Spring是如何读取到配置文件并进行依赖注入的呢 ...

  9. Spring Boot 配置文件详解

    Spring Boot配置文件详解 Spring Boot提供了两种常用的配置文件,分别是properties文件和yml文件.他们的作用都是修改Spring Boot自动配置的默认值.相对于prop ...

  10. Springboot 系列(二)Spring Boot 配置文件

    注意:本 Spring Boot 系列文章基于 Spring Boot 版本 v2.1.1.RELEASE 进行学习分析,版本不同可能会有细微差别. 前言 不管是通过官方提供的方式获取 Spring ...

随机推荐

  1. 机器学习--Xgboost调参

    Xgboost参数 'booster':'gbtree', 'objective': 'multi:softmax', 多分类的问题 'num_class':10, 类别数,与 multisoftma ...

  2. fiddler抓取https请求

    Fiddler抓取https设置详解(图文):https://www.cnblogs.com/joshua317/p/8670923.html Fiddler要抓取到https请求我们还需要Fiddl ...

  3. 定点CORDIC算法求所有三角函数及向量模的原理分析、硬件实现(FPGA)

    一.CORDIC算法 CORDIC(Coordinate Rotation DIgital Computer)是一种通过迭代对多种数学函数求值的方法,它可以对三角函数.双曲函数和平面旋转问题进行求解. ...

  4. 【IDEA】关于idea开发工具使用

    idea这个开发工具有很强大的功能,然鹅有时候某些地方需要注意...(注明一下,我的版本2017.3.2因为不知道新版本有木有优化) 先说说建包,比如我在src下建了个com.xxxxx.test的包 ...

  5. 获取当前div中的文本(只获取当前div的, 子元素不要, 基于layui)

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  6. django执行原生sql

    一.ORM row()方法:只能实现查询 d_list = models.Article.objects.raw( 'select nid, count(nid) as num,strftime(&q ...

  7. MySQL主备

    服务器基本环境: 两台centos6.4.iptables  diabled .selinux  disabled 两台的hosts解析 #yum install mysql -y  //这个一定要装 ...

  8. 识别手机浏览器代码【C#和JS两种语言】

    C# 识别手机浏览器代码: public static bool MobileBrowserDetect() { bool bismobile = false; try { #region 包含and ...

  9. vue slot 复用

    话不投机半句多,直接上代码 有3步 第一步:创建渲染slot的组件 重要 第二步:为slot添加父组件数据(props) 重要 第三步:使用 第一步:创建渲染slot的组件 首选创建一个单文件组价,由 ...

  10. Synchronized和Lock的区别

    ①synchronized是jvm的关键字,Lock是Java类: ②synchronized会自动释放锁,而Lock需要在finally语句中主动释放锁,否则会造成死锁 ③用synchronized ...