Spring Aspect not executed when defined in other JAR

后端 未结 4 2129
故里飘歌
故里飘歌 2021-01-18 08:27

I have a project consisting of two subprojects which are both Spring projects and have an applicationContext.xml each.

One is a framework project (which ends up as

4条回答
  •  一向
    一向 (楼主)
    2021-01-18 08:48

    I think you need to make your aspect a component to have it recognised by spring:

    http://static.springsource.org/spring/docs/3.2.x/spring-framework-reference/html/aop.html#aop-at-aspectj

    Autodetecting aspects through component scanning

    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).

提交回复
热议问题