繁体   English   中英

Spring AOP 对依赖项不起作用(Spring Boot)

[英]Spring AOP doesn't work on dependencies(Spring Boot)

我正在尝试在我的项目上实现 AOP,该项目有多个 API 连接器客户端添加为pom 依赖项。 无法修改依赖项,因此我尝试在父项目上添加 AOP 逻辑。

例子。 项目A

<dependencies>
    <!------ other dependencies ------->
    <dependency>
       <groupId>x.y</groupId>
       <artifactId>api-client-b</artifactId>
       <version>1.0.0</version>
    </dependency>
    <dependency>
       <groupId>p.q</groupId>
       <artifactId>api-client-c</artifactId>
       <version>1.0.0</version>
    </dependency>
</dependencies>

     

AOP 代码在应用于项目 A 的类时运行良好,但是当我尝试将其添加到一些 class 内部时,比如说api-client-bapi-client-c它不起作用。 有人可以帮助我了解我做错了什么,还建议解决方法吗?

请注意:我无法修改api-client-bapi-client-c

如果您没有方面的源代码或在 class 文件或 JAR 文件上应用 AOP,那么您可以进行编译后编织或加载时编织。

这个概念在这篇文章中得到了很好的解释

https://www.baeldung.com/aspectj

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM