使用Spring面向切面编程

1.介绍

AOP是OOP的补充,提供了另一种关于程序结构的思路.

OOP的模块化的关键单位是 类 .

AOP的则是aspect切面.

AOP 将程序的逻辑分成独立的块(叫做concern 重心,关注点).

AOP是用来增加跨切重心(cross-cutting concerns)的模块化的.

A cross-cutting concern 是一个可以影响整个程序的concern ,应该尽可能地在代码的某个位置中心化.

例如:事务管理,授权,登录,日志,安全等.

2.为什么使用AOP

提供pluggable方法来动态增加附加的concern:before,after 或者around 逻辑块.

AOP的入口在xml文件中.

3. 在哪里使用AOP

在以下场景:

  • to provide declarative enterprise services such as declarative transaction management.
  • It allows users to implement custom aspects.

4.AOP概念和术语

  • Join point
  • Advice
  • Pointcut
  • Introduction
  • Target Object
  • Aspect
  • Interceptor
  • AOP Proxy
  • Weaving

4.1 Join point

Spring只提供方法执行接入点.

4.2 Advice

[Spring] Aspect Oriented Programming with Spring | AOP | 切面 | 切点的更多相关文章

  1. 面向切面编程 ( Aspect Oriented Programming with Spring )

    Aspect Oriented Programming with Spring 1. 简介 AOP是与OOP不同的一种程序结构.在OOP编程中,模块的单位是class(类):然而,在AOP编程中模块的 ...

  2. 关于spring.net的面向切面编程 (Aspect Oriented Programming with Spring.NET)-使用工厂创建代理(Using the ProxyFactoryObject to create AOP proxies)

    本文翻译自Spring.NET官方文档Version 1.3.2. 受限于个人知识水平,有些地方翻译可能不准确,但是我还是希望我的这些微薄的努力能为他人提供帮助. 侵删. 如果你正在为你的业务模型使用 ...

  3. 关于spring.net的面向切面编程 (Aspect Oriented Programming with Spring.NET)-简介

    本文翻译自Spring.NET官方文档Version 1.3.2. 受限于个人知识水平,有些地方翻译可能不准确,但是我还是希望我的这些微薄的努力能为他人提供帮助. 侵删. 简介 Aspect-Orie ...

  4. 关于spring.net的面向切面编程 (Aspect Oriented Programming with Spring.NET)-通知(Advice)API

    本文翻译自Spring.NET官方文档Version 1.3.2. 受限于个人知识水平,有些地方翻译可能不准确,但是我还是希望我的这些微薄的努力能为他人提供帮助. 侵删. 让我们看看 Spring.N ...

  5. 关于spring.net的面向切面编程 (Aspect Oriented Programming with Spring.NET)-切入点(pointcut)API

    本文翻译自Spring.NET官方文档Version 1.3.2. 受限于个人知识水平,有些地方翻译可能不准确,但是我还是希望我的这些微薄的努力能为他人提供帮助. 侵删. 让我们看看 Spring.N ...

  6. Spring之 Aspect Oriented Programming with Spring

    1. Concepts Aspect-Oriented Programming (AOP) complements OOP by providing another way of thinking a ...

  7. Java 面向切面编程(Aspect Oriented Programming,AOP)

    本文内容 实例 引入 原始方法 装饰者模式 JDK 动态代理和 cglib 代理 直接使用 AOP 框架--AspectWerkz 最近跳槽了,新公司使用了 AOP 相关的技术,于是查点资料,复习一下 ...

  8. Spring面向切面编程(AOP,Aspect Oriented Programming)

    AOP为Aspect Oriented Programming的缩写,意为:面向切面编程(也叫面向方面),可以通过预编译方式和运行期动态代理实现在不修改源代码的情况下给程序动态统一添加功能的一种技术. ...

  9. 关于面向切面编程Aspect Oriented Programming(AOP)

    最近学到spring ,出来了一个新概念,面向切面编程,下面做个笔记,引自百度百科. Aspect Oriented Programming(AOP),面向切面编程,是一个比较热门的话题.AOP主要实 ...

随机推荐

  1. linux下部署git服务器

    我这里用的是redhat7.4, 直接开始吧. 环境 服务端: Redhat7.4 + git(version 1.8.3.1) IP:192.168.137.168 客户端: win7 + git ...

  2. Kali系列之Hydra/Medusa mysql密码爆破

    hydra hydra -L /home/chenglee/zidian/user.txt -P /home/chenglee/zidian/wordlist.TXT 192.168.137.133 ...

  3. git初学

    git在团队合作开发时是很有用的,SVN是集中式的代表,而git是分布式的代表,它分为代码区.暂存区.和本地库.在同一个团队中开发时,在代码存储中心(例如,码云.github)上创建一个库,用于储存和 ...

  4. topcoder srm 555 div1

    problem1 link 直接动态规划即可. problem2 link 假设有$r$行,$c$列被修改了奇数次,那么一定有$r*W+c*H-2*r*c=S$.可以枚举这样的组合$(r,c)$,然后 ...

  5. topcoder srm 425 div1

    problem1 link 暴力搜索即可. problem2 link 可以将每次所有的piece的位置看作一个状态,由于$C_{25}^{5}=53130$,所以最多有这么多状态.这里可以加一些优化 ...

  6. Bootstrap3基础 bg-danger/info... 辅助类样式 背景文本颜色

      内容 参数   OS   Windows 10 x64   browser   Firefox 65.0.2   framework     Bootstrap 3.3.7   editor    ...

  7. IPVS负载均衡

    概念: ipvs (IP Virtual Server) 实现了传输层负载均衡,也就是我们常说的4层LAN交换,作为 Linux 内核的一部分.ipvs运行在主机上,在真实服务器集群前充当负载均衡器. ...

  8. 【原理、应用】Quartz集群原理及配置应用

    一.Quartz任务调度的基本实现原理 Quartz是OpenSymphony开源组织在任务调度领域的一个开源项目,完全基于Java实现.作为一个优秀的开源调度框架,Quartz具有以下特点: 强大的 ...

  9. hihoCoder week14 无间道之并查集

    并查集的基本使用 #include <bits/stdc++.h> using namespace std; ; int n, fa[N]; int cnt, tot; map<st ...

  10. 一文读懂 深度强化学习算法 A3C (Actor-Critic Algorithm)

    一文读懂 深度强化学习算法 A3C (Actor-Critic Algorithm) 2017-12-25  16:29:19   对于 A3C 算法感觉自己总是一知半解,现将其梳理一下,记录在此,也 ...