In AOP, the checkSecurity() method inside SecurityChecker is an advice, which is an action to take care of a specific concern, in this case, a security concern. And there are different types of advice, including the following:
- Before advice: Advice to be executed before a join point, which cannot prevent the code execution reaching the join point unless it throws an exception. You can specify before advice with the @Before annotation.
- After returning advice: Advice to be executed after a join point completes normally without throwing an exception. You can specify after returning advice with the @AfterReturning annotation.
- After throwing advice: Advice to be executed when a method exits by throwing an exception. You can specify