for example reviewing this code
@Aspect
class CommandExecuteInterceptor implements ApplicationContextAware {
private ApplicationContext context;
what does @aspect mean, why use it, when to use it?
for example reviewing this code
@Aspect
class CommandExecuteInterceptor implements ApplicationContextAware {
private ApplicationContext context;
what does @aspect mean, why use it, when to use it?
This has to do with the paradigm of Aspect Oriented Programming (AOP), I will tell you briefly:
Aspect Oriented Programming (AOP) is a programming paradigm that tries to formalize and concisely represent the elements that are transversal to the entire system. How is this? a common example is controlling the execution permissions of certain methods in a class.
In AOP, the elements that are transversal to the structure of the system and can be modularized thanks to the constructions provided by the paradigm are called aspects.
An aspect is a set of advices. Following the AspectJ syntax, aspects are represented as Java classes, marked with the @Aspect annotation. In Spring, moreover, an aspect must be a bean, so it has to be annotated as such.
More info: Spring AOP