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

Support for meta-annotations #163

Open
einachim opened this issue Jan 22, 2016 · 3 comments
Open

Support for meta-annotations #163

einachim opened this issue Jan 22, 2016 · 3 comments

Comments

@einachim
Copy link

Hi,

i tried to create a meta annotation (http://docs.spring.io/spring/docs/current/spring-framework-reference/html/beans.html#beans-meta-annotations) that uses spring retry and metrics-spring:

@Inherited
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Metered
@ExceptionMetered(cause = RuntimeException.class)
@Retryable(include = {
        DuplicateKeyException.class,
        OptimisticLockingFailureException.class})
public @interface ServiceMethod {

}

so that i only have to define one simple annotation at service level:

@ServiceMethod
public void methodA() {
}

This seems to work for spring retry but not for metrics-spring.

@ryantenney
Copy link
Owner

Yea, I'm afraid I haven't added support for this yet. It's on the todo list.

@b0n541
Copy link

b0n541 commented Jan 22, 2016

I would like to have this feature too. 👍

einachim pushed a commit to einachim/metrics-spring that referenced this issue Jan 25, 2016
@einachim
Copy link
Author

I created a pull request. It is a good starting point for enabling meta annotations. There are 2 tests (CovariantReturnTypeTest + MeteredInterfaceTest) that will break because annotations at interface level will now be taken into consideration. I think this should be the correct behaviour because the codahale annotations are marked with Inherited.

I added a test (MetaAnnotationTest). The Counted annotation has no support for element type ANNOTATION_TYPE. So there is no test for that case. I do not understand why the annotation from codahale is not used in the CountedMethodInterceptor. Why does your Counted annotation exist?

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

3 participants