Lightweight yet comprehensive library to log the execution time of your methods in Spring Boot components.
Relies on slf4j for logging.
- java 17
- an existing Spring Boot application
- minimum Spring Boot version supported:
2.5.0
- implementing either spring-boot-starter-aop or aspectjweaver dependency
- minimum Spring Boot version supported:
Get the latest version from Maven Central.
<dependency>
<groupId>io.github.dario-mr</groupId>
<artifactId>time-it</artifactId>
<version>${latestVersion}</version>
</dependency>
Get the latest JAR from Github Packages, or generate your own with the maven command:
mvn package
@Service
public class MyService {
@TimeIt
public void myMethod() {
// my code
}
}
@TimeIt
can be configured at annotation level via the properties:
unit
(defaultMILLISECONDS
)logLevel
(defaultINFO
)
@Service
public class MyService {
@TimeIt(unit = TimeUnit.SECONDS, logLevel = Level.WARN)
public void myMethod() {
// my code
}
}