Advices

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 after throwing advice with the @AfterThrowing annotation.
  • After advice: Advice to be executed regardless of the execution of a join point. It is like the final block in a try...catch. You can specify after advice with the @After annotation.
  • Around advice: Advice surrounding a join point. This type of advice has full control of the code execution and hence is the most powerful. You can specify around advice with the @Around annotation, just as in the preceding example.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.158.36