What is an Advice?  What are the different types of Advices?

devquora
devquora

Posted On: Feb 22, 2018

 

An Action, which is taken by any aspect at a particular join point, is called an Advice. AOPs use an advice as an interceptor that maintains a train of interceptors near the join point.
Various types of advice are as follows:
  • Before: These are types of advices, which get executed before the join point methods and can be configured using @Before annotation mark.
  • After returning: These are the types of advices which get executed after the join point methods completes executing and the annotation mark used to configure it is @AfterReturning
  • After throwing:  These are the types of advices that execute only and only if join point method returns by exiting an exception and annotation mark used to configure it is @AfterThrowing.
  • After (finally): These are the types of advices which gets executed after a join point method, not concerning whether the method’s exit normally or exceptional return and it can be configured using @After annotation mark.
  • Around: These are the types of advices that get executed before and after a join point and can be configured using the @Around annotation mark.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Spring Interview Questions

    What are the features/ characteristics of spring?

    The important features of spring are as follows:Lightweight: Considering transparency and size, spring is lightweight..

    Spring Interview Questions

    How many types of modules are there in spring? Name them.

    There are around twenty modules, which can be categorized into Core Container, Web, Data Access or Integration, Aspect ..

    Spring Interview Questions

    What do you mean by Spring Java Based Configuration?

    Spring configuration files are XML files. These files contain the information of classes and describe how these classes..