Create custom method level annotation only available to specific return types [AOP]
问题 I want to create an annotation which is only available to a specific type of return values. For example this is my annotation. @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD}) public @interface MyAnnotation { } I also have an interface: public interface MyInterface { String generateKey(); } An example class that implements my interface: public class ExampleClass implements MyInterface { @Override public String generateKey() { return "Whatever"; } } So after these, I want to