I have a qualifier annotation that I use to autowire a specific bean like this:
@Autowired
@MyAnnotation
private MyClass myClass;
@Bean
@MyAnnotation
public MyClass myClass()
{
return new MyClassImpl();
}
@Retention( RetentionPolicy.RUNTIME )
@Qualifier
public @interface MyAnnotation
{
}
The above works, but I want to make sure that the annotation can only be used on classes that implement the MyClass interface. How would I do this?