Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Managing "hundreds" of classes with "hundreds" of methods with multiple annotations #72

Open
adenysenko opened this issue May 1, 2014 · 5 comments

Comments

@adenysenko
Copy link

Is there a way to manage "hundreds" of classes with "hundreds" of methods with multiple annotations?

@ryantenney
Copy link
Owner

What exactly do you mean by "manage"?

@adenysenko
Copy link
Author

I mean configure "metrics" to collect in centralized way without having annotate at the method level.

@ryantenney
Copy link
Owner

There isn't, methods need to be annotated individually. If you're looking for a bulk approach I'd strongly consider using spring-aop. You would have to write a class which implements org.aopalliance.intercept.MethodInterceptor, but then you'd be able to instrument all your classes in a couple lines of XML:

    <bean id="metricsInterceptor" class="com.foo.MetricsMethodInterceptor" />
    <aop:config>
        <aop:advisor advice-ref="metricsInterceptor" pointcut="execution(public * com.foo.service..*(..))" />
    </aop:config>

@adenysenko
Copy link
Author

It looks like the interceptor you are describing has similar functionality to your MeteredMethodInterceptor, TimedMethodInterceptor ....
Is it possible to reuse them?

@ryantenney
Copy link
Owner

Instances of the MeteredMethodInterceptor, etc in this project are all specific to one class and scan its methods for annotations. You'd do better to start from scratch.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants