According to Spring\'s Documentation Configuring AspectJ aspects using Spring IoC in order to configure an aspect for Spring IOC, the following has to be added to the xml co
Is there an equivalent way of writing this using JavaConfig?
Almost always.
@Bean
public com.xyz.profiler.Profiler profiler() {
com.xyz.profiler.Profiler profiler = com.xyz.profiler.Profiler.aspectOf();
profiler.setProfilingStrategy(jamonProfilingStrategy()); // assuming you have a corresponding @Bean method for that bean
return profiler;
}
The factory-method
is explained in the documentation in Instantiation with a static factory method.