Monday, April 6, 2015

StopWatch with annotations to Profile methods using Spring Aspect Oriented Programming (AOP)

The following example is a way to measure the execution time for methods using Spring Aspect Oriented Programming (AOP).

First we need to create a new annotation:

import java.lang.annotation.*;


@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Inherited
@Documented
public @interface ProfileExecution 

{

}