1 package org.imageconverter.config;
2
3 import org.imageconverter.application.ImageConversionService;
4 import org.imageconverter.util.performance.PerformanceMonitor;
5 import org.springframework.aop.Advisor;
6 import org.springframework.aop.aspectj.AspectJExpressionPointcut;
7 import org.springframework.aop.support.DefaultPointcutAdvisor;
8 import org.springframework.context.annotation.Bean;
9 import org.springframework.context.annotation.Configuration;
10
11 @Configuration
12 public class LogPerformanceConfiguration {
13
14 @Bean
15 public Advisor performanceMonitorAdvisor(final PerformanceMonitor performanceMonitor) {
16
17 final var pointCut = new AspectJExpressionPointcut();
18
19 final var expression = new StringBuilder()
20 .append(performanceMonitor.createExpression(ImageConversionService.class))
21 .toString();
22
23 pointCut.setExpression(expression);
24
25 return new DefaultPointcutAdvisor(pointCut, performanceMonitor);
26 }
27 }