<dependency>
<groupId>org.easymetrics</groupId>
<artifactId>easymetrics-core</artifactId>
<version>1.0.0</version>
</dependency>
@Aspect
public class MetricsAspect {
@Pointcut("execution(* com.example.*.*(..))")
public void performanceMonitor() {
}
@Before("performanceMonitor()")
public void beforeMethodExecution(JoinPoint joinPoint) {
}
@AfterReturning("performanceMonitor()")
public void afterMethodExecution(JoinPoint joinPoint) {
}
@AfterThrowing(pointcut = "performanceMonitor()", throwing = "ex")
public void afterMethodThrowsException(JoinPoint joinPoint, Exception ex) {
}
}
<aop:aspectj-autoproxy />
<bean id="metricsAspect" class="com.example.MetricsAspect" />
<bean id="metricsCollector" class="org.easymetrics.core.collector.ConsoleMetricsCollector">
<property name="enabled" value="true" />
</bean>