What is AOP? How we can use AOP in SAP Commerce(Hybris) to measure execution time of methods?

  • Aspect — module which has a set of APIs providing cross-cutting requirements. It can be normal class configured through XML configuration or through regular classes annotated with @Aspect;
  • Advice — it is the action taken by an aspect at a particular join-point(before or after);
  • Joinpoint — possible points at which an advice can be applied (advised), will plug-in the AOP aspect;
  • Pointcut — set of one or more join points where an advice should be executed;
  • Weaving — the process of linking aspects with other application types or objects to create an advised object.
  • before — run advice before the a method execution;
  • after — run advice after the method execution;
  • around — run advice before and after the advised method is called;
  • after — returning — run advice afther the method execution only if method is completed;
  • after — throwing — run advice after method execution only if methods throws exception.
  1. Create class MethodExecutionTimeAspect

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store