【问题标题】:AspectJ and Springboot not working togetherAspectJ 和 Springboot 不能一起工作
【发布时间】:2014-11-24 14:51:56
【问题描述】:

在我的项目中,我想将纯 aspectj 与 spring-boot 结合使用 在配置项目时,我们遇到了一些问题。

找到另一个similar problem,但这对我们没有帮助。

这就是我们所做的:

  • 得到springboot项目
  • 定义了2个方面,1个简单的spring主类
  • 在 gradle build 中添加了 aspectj 插件
  • 设置 applicationDefaultJvmArgs 以将 javaagent 用于 aspectjweaver

这里是我们在 github 上的 repo 的链接。 https://github.com/svenhornberg/MDSD

这是 Travis-CI 构建日志https://travis-ci.org/svenhornberg/MDSD/builds

但它仍然无法正常工作。

我想我需要一些帮助。

【问题讨论】:

    标签: aspectj spring-boot load-time-weaving


    【解决方案1】:

    您似乎试图混合编译时编织和加载时编织您的类。您应该选择一种方法并始终如一地使用它。

    如果您想使用编译时编织,请从 Application 中删除 @EnableLoadTimeWeaving 并更新 build.gradle 以删除 applicationDefaultJvmArgs 的配置。您还可以进行其他清理工作,但这两项更改应该足以让您的应用程序启动并运行。有了这些更改,在启动时我看到它输出:

    1
    Please use List instead of a concrete implementation for method: findByPrio.
    []
    Please use List instead of a concrete implementation for method: returnTest.
    You used a method with only one boolean parameter. Refactor it into 2 methods with True, False at the end.
    true
    

    【讨论】:

    • 非常感谢,这太棒了!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-07
    • 2019-08-17
    • 2016-11-23
    • 2019-02-18
    • 2015-05-16
    • 2017-10-14
    相关资源
    最近更新 更多