【问题标题】:Spring AOP issue with multi maven project多 Maven 项目的 Spring AOP 问题
【发布时间】:2014-07-07 06:20:47
【问题描述】:

您好,我正在使用一个多 Maven 弹簧项目 在 POM 中使用模块

  1. Bhoomi-domain-it
  2. Bhoomi-data-it
  3. Bhoomi 域
  4. Bhoomi 数据
  5. Bhoomi 演示文稿
  6. Bhoomi-integration-consumer
  7. Bhoomi 集成提供者

与个人pom.xml

我在 Bhoomi-presentation 包含

的模块中创建了一个 LoggerAspect 类
@Pointcut("execution(* *.*(..))")

问题是当我正在构建项目时(Bhoomi-presentation-0.1.0.BUILD-SNAPSHOT.war),它只记录 Bhoomi-presentation 模块中存在的类文件的日志,而不是其他模块的日志

所有其他模块在 WAR 的 lib 中以 jar 的形式存在

如果我忘记了任何配置,请告诉我,以便我可以记录所有项目日志

【问题讨论】:

标签: java spring spring-aop aspectj-maven-plugin


【解决方案1】:
I can think of something like this in XML( surely it can be done with annotations as well ) for creating common pointcuts spanning multiple modules

<aop:config>
        <aop:pointcut id="appPointcutServices" expression="bean(*Services)" />
        <aop:pointcut id="appPointcutDao" expression="bean(*Dao)" />
        <aop:pointcut id="appPointcutRepository" expression="bean(*Repository)" />
<aop:config>

& Then attach these pointcuts with your application defined Advisor

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-13
    • 2017-06-16
    • 2016-08-15
    相关资源
    最近更新 更多