spring aspect为啥要加 component
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了spring aspect为啥要加 component相关的知识,希望对你有一定的参考价值。
参考技术A官方文档中有写:
You may register aspect classes as regular beans in your Spring XML configuration, or autodetect them through classpath scanning - just like any other Spring-managed bean. However, note that the @Aspect annotation is not sufficient for autodetection in the classpath: For that purpose, you need to add a separate @Component annotation (or alternatively a custom stereotype annotation that qualifies, as per the rules of Spring's component scanner).
<!-- 使用annotation 自动注册bean,并保证@Required,@Autowired的属性被注入 -->
<context:component-scan base-package="com.evo.bpc" annotation-config="true"/>
以上是关于spring aspect为啥要加 component的主要内容,如果未能解决你的问题,请参考以下文章
Spring - 为啥我们需要标记一个类@repository(或@Component以外的任何东西)[重复]