ProfilerConfig.java

package esa.bscs.pds4.packager.config;

import static org.springframework.context.annotation.EnableLoadTimeWeaving.AspectJWeaving.AUTODETECT;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.EnableLoadTimeWeaving;
import org.springframework.context.annotation.LoadTimeWeavingConfigurer;
import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver;
import org.springframework.instrument.classloading.LoadTimeWeaver;
import org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver;

import esa.bscs.pds4.packager.aspect.PackagerProfiler;
import esa.bscs.pds4.validate.aspect.ValidateProfiler;

@Configuration
@EnableAspectJAutoProxy(proxyTargetClass=true)
@EnableLoadTimeWeaving(aspectjWeaving = AUTODETECT)
public class ProfilerConfig implements LoadTimeWeavingConfigurer {
    
    @Override
    public LoadTimeWeaver getLoadTimeWeaver() {
        return new ReflectiveLoadTimeWeaver();
    }
    
    @Bean
    public InstrumentationLoadTimeWeaver loadTimeWeaver() {
        return new InstrumentationLoadTimeWeaver();
    }
    
    @Bean
    public PackagerProfiler packagerProfiler() {
        return new PackagerProfiler();
    }
    
    @Bean
    public ValidateProfiler validateProfiler() {
        return new ValidateProfiler();
    }
}