Example of application in spring Boot 3.2 using AOP.
Invoke the function getMemoryUsed. The function logAll
of the class CheckMemoryAspect is invoked.
If the parameter iterations is high, and you make a lot of calls, the use of memory can be enough bigger to throw a Exception.
Invoke the function doSomethingMore. In the log of the applicatión you can see that the function execute the function logAll
Invoke the function doSomethingMore. In the log of the applicatión you can see that the function execute the function logAll
and the function aroundPoint1
Invoke the function doSomethingWithParam
. In the log of the applicatión you can see that the function execute the function logAll
and the function aroundPoint1
of LogAspect
In the function aroundPoint1
the text sent is printed. If the text is "skip" the function doSomethingWithParams
of TestService
is not exeuted.