Please ... can someone explain to me what is the difference between using the following spring pointcut pointers?
Using the "inside pointcut pointer":
<aop:pointcut expression="within(my.app.dao.impl.*)" id="commonDaoOperation"/>
Using a "pointcut point":
<aop:pointcut expression="execution(public * my.app.dao.impl.*.*(..))" id="commonDaoOperation"/>
I use the second one in my web projects (and I think it is most often used), the problem I found with this approach is that it consumes a lot of memory on the heap ...
After analyzing the heap dump of the application server with the eclipse memory analyzer, I found that my application consumes 450 MB, and instances of the class "org.springframework.aop.aspectj.AspectJExpressionPointcut consume 30% of these 450 MB ..
Each AspectJExpressionPointcut instance takes 6 MB (approximately), and this is due to the fact that each instance maintains a match cache for java.lang.reflect.Method instances and, surprisingly, there are many Java caching methods (methods that my pointcut expression does not mentions).
After reading the spring Documentation, I decided to use the first approach (in the pointcut pointer), and now each instance of AspectJExpressionPointcut takes up much less memory.
The question is ... what is the difference in performance between the two ...
Thank you very much in advance...
java spring spring-aop
glazaror
source share