I am trying to build a custom performance measuring library, which an user can use to measure the performance of any method in an application. My goal is to achieve this thing without changing the existing Java code of the user's application.
The library will use a MethodInterceptor
implementation as an advice to measure the performance. The only input from the user will be a pointcut expression of his/her choice, nothing else. And using the provided pointcut expression, my library will be able to intercept the matching method call to measure the performance.
In a nutshell user will only configure like below in spring xml:
<bean id="configBean" class="com.something.PointCutConfigBean">
<property name="patterns">
<list>
<value>"execution(* com.company.CustomerDao.addCustomer(..))"</value>
</list>
</property>
</bean>
My question is how can I achieve this in my library? How do I implement the PointCutConfigBean
class? I can use spring 2 and aspectj.
I know, same thing can be achieved if the user just write a normal <aop:config
and use my advice. But I am just looking for something cooler if at all possible.