Simple built-in profiling without any extra tools
With Gradle
runtime('cc.catalysts.boot:cat-boot-profiling:' + catBootVersion)
This module comes with an AutoConfiguration.
Use the annotation @MethodProfling on any Spring Bean to log method calls. Nested calls to multiple beans that have that annotation are accumulated. As an example, if you have those two beans:
@MethodProfiling
@Component
public class SimpleBean {
@Autowired
NestedBean nestedBean;
public String callMe() {
return nestedBean.callMeAgain();
}
}
@MethodProfiling
@Component
public class NestedBean {
public String callSubMethod() {
return "Test";
}
}
And you then perform a call to simpleBean.callMe(), then you might run into log output like this:
[2016-04-30 12:53:52.524] TRACE [main] --- c.c.b.p.SimpleBean:
----------------------------------------------------------------------------------
calls avg ms total ms % Signature
----------------------------------------------------------------------------------
1 59,00 59 98,33 SimpleBean.callMe()
1 29,00 29 48,33 NestedBean.callSubMethod()
Don't forget to set the log level of your target bean (the bean that holds the annotation) to TRACE.