可能的AOP用例有哪些? [英] What are the possible AOP use cases?

查看:125
本文介绍了可能的AOP用例有哪些?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解AOP在应用程序设计中有效参与的可能案例。到目前为止我所遇到的只有:

I'd like to make a picture of what are the possible cases for effective involvement of AOP in application design. All I have met so far is:


  • 与日志相关的

  • 安全检查

  • 交易管理

  • 调整遗留应用程序

  • logging-related
  • security checks
  • transaction management
  • tweaking of a legacy application

其他?

(它不一定是Spring基于代理的AOP - 而是JBoss AOP。)

(It doesn't have to be necessarily Spring's proxy based AOP - rather JBoss AOP.)

相关问题

推荐答案

我可以举两个例子来说明我们使用它:

I can give you two examples where we use it:


  • 在JMX中自动注册对象以进行远程管理。如果一个类使用我们的 @AutoRegister 注释进行注释,我们有一个方面可以监视该类的新实例并自动在JMX中注册它们。

  • Automatically registering objects in JMX for remote management. If a class is annotated with our @AutoRegister annotation, we have an aspect that watches for new instantiations of that class and registers them in JMX automatically.

审核日志记录(黄金标准AOP用例)。它有点粗糙,但一般的方法是注释代表一些可审计行为的方法。结合Spring Security之类的东西,我们可以很好地了解:

Audit logging (the gold standard AOP use case). Its a bit coarse but the general approach is to annotate methods that represent some auditable action. Combined with something like Spring Security, we can get a pretty good idea of:


  • 用户是谁

  • 他们调用的方法

  • 他们提供的数据

  • 调用该方法的时间

  • 调用是否成功(即抛出异常)

  • who the user is
  • what method they're invoking
  • what data they're providing
  • what time the method was invoked
  • whether the invocation was successful or not (i.e., if an exception was thrown)

这篇关于可能的AOP用例有哪些?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆