答案是不
除非注释类型具有@Inherited元注释,否则不会继承Java注释:https
:
//docs.oracle.com/javase/7/docs/api/java/lang/annotation/Inherited.html。
Spring的
@Component注释上没有@Inherited,因此您需要将注释放在每个组件类上。@
Service,@ Controller和@Repository都没有。

答案是不
除非注释类型具有@Inherited元注释,否则不会继承Java注释:https
:
//docs.oracle.com/javase/7/docs/api/java/lang/annotation/Inherited.html。
Spring的
@Component注释上没有@Inherited,因此您需要将注释放在每个组件类上。@