<?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. gitlab中批量删除本地以及远程tag的操作

    git 批量删除标签# 删除所有远程标签git show-ref --tag | awk '{print ":" $2}' | xargs git push origin # 删除 ...

  2. saver.restore()遇到的错误

    运行python程序执行  saver.restore(sess,"E:/pythonFile/untitled/deepLearning/model/model.ckpt")   ...

  3. ajax请求aspx.cs后台方法

    前台jquery代码 $(function () { $("#btnfix").click(function () { $.ajax({ type: "post" ...

  4. git pre-push hook

    This article introduces git pre-push hook. Problem In Lean project, we use a modified version of Goo ...

  5. Huawei BGP和OSPF双边界重分布(一)

    网络拓扑: PS:本例使用明细前缀列表双边界引入 S5700-LSW1 ================================================================ ...

  6. CentOS 7 安装与卸载MySQL 5.7

    先介绍卸载 防止重装 yum方式 查看yum是否安装过mysql yum list installed mysql* 如或显示了列表,说明系统中有MySQL yum卸载 根据列表上的名字 yum re ...

  7. python字符串处理内置方法一览表

    python字符串处理内置方法一览表   序号 方法及描述 1 capitalize()将字符串的第一个字符转换为大写 2 center(width, fillchar) 返回一个指定的宽度 widt ...

  8. 总结一下我的dmp第一个版本 也是最后一个版本

      刚刚接手了一个新项目-DMP,目前已经开发联调完成,等待测试上线,所以现在来总结一下. 本来是一个前辈在负责,四月底离职了,他离职前我花了一周把这个项目交接了过来,大致熟悉了项目的业务流程以及代码 ...

  9. c#线程池中的异常

    static void Main(string[] args) { //写日志 //使用线程池 ; i < ; i++) { ThreadPool.QueueUserWorkItem(new W ...

  10. scrapy Mongodb 储存

    pipelines.py # -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your ...