Interfaces are annotated with @Component annotation in spring IoC/DI. What could be the reason?
问题 Some times interfaces are annotated with @Component annotation. Then my obvious reasoning was that classes that implement such interface will be treated as components as well. But if I am right that is not the case. So what is the purpose of @Component annotation on interfaces. 回答1: Annotating an interface with @Component is common for Spring classes, particularly for some Spring stereotype annotations : package org.springframework.stereotype; ... @Component public @interface Service {...} or