Spring项目中AOP最常见的用途是什么 [英] What is the most common use for AOP in spring project

查看:28
本文介绍了Spring项目中AOP最常见的用途是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在回顾了 AOP 模式之后,我对在我的 spring 项目中如何使用它以及如何使用它的方式感到不知所措.

After reviewing the AOP pattern, I'm overwhelmed with the ways of how and what to use it for in my spring project.

我想用它作为所有金融业务逻辑的审计日志系统.它似乎很容易集成.但我想听听您对此的看法.

I'd like to use it as audit log system of all the financial business logic. It just seems to be easy to integrate. But I'd like to hear your take on this.

问题是 - 对于这种模式,我还应该考虑哪些其他常见用途?只要有好处,我不介意重构我当前的逻辑以与 AOP 一起使用.

The question is - what other uses should I consider that are common for this pattern? I would not mind refactoring my current logic to be used with AOP as long as there is benefits to it.

推荐答案

最常见的用法是您的应用程序具有横切关注点,即将要在多个类/层中编写的一段逻辑或代码.

The most common usage is where your application has cross cutting concerns i.e. a piece of logic or code that is going to be written in multiple classes/layers.

这可能会根据您的需求而有所不同.其中一些非常常见的示例可能是:

And this could vary based on your needs. Some very common examples of these could be:

  1. 交易管理
  2. 记录
  3. 异常处理(尤其是当您可能希望获得详细的跟踪信息或制定一些从异常中恢复的计划时)
  4. 安全方面
  5. 仪表

希望有所帮助.

这篇关于Spring项目中AOP最常见的用途是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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