I am learning AOP
and came to know that is useful for separation of concern, for example, logging
, transaction management
, security
etc.
So far good to know AOP
.
Now, I read about Spring transaction management in Spring framework we can have annotation @Transactional
.
It is this point which is make me confused why should we use AOP
in which we have to create Aspects
rather than using the annotation which Spring provides.
For example:
@Transactional
public void dataAccessTrans() {
}
When Spring is already having transaction related functionality, then why should we use AOP
to do transaction management?
If we use AOP
, then don't we have to create Aspect
and create advice
which would act on the method; does't this make us to do manual work, rather than handling it by spring framework itself by its own annotations.
Can anyone help me understand this which I am not able to understand clearly.