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.
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.
AOP is used in the Spring Framework to... ... provide declarative enterprise services, especially as a replacement for EJB declarative services. The most important such service is declarative transaction management.
Some of the cases where AOP is frequently used: To provide declarative enterprise services. For example, as declarative transaction management. It allows users for implementing custom aspects.
You can use AOP to reduce code clutter by improving the readability and maintainability of your code. It should be noted that AOP is just a new programming paradigm -- it doesn't replace OOP in any way. Rather, it complements OOP by providing you another way to achieve modularity and also reduce code clutter.
logging-related. security checks. transaction management. tweaking of a legacy application.
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:
Hope that helps.
Besides logging/auditing and declarative transaction handling as mentioned by Axel, I would say another usage of AOP is as a request interceptor. For example, let's say you need all requests coming of a server to be intercepted so that you can do something with it (may be to keep track of which app is sending what request to what other app or what database, etc).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With