Why Spring AOP is not weaving external jars at runtime?

前端 未结 6 905
醉话见心
醉话见心 2020-12-29 14:46

I have a java application build upon Spring 3. This project has another jar as a dependency.

This dependency contains a @org.aspectj.lang.annotation.Aspect

6条回答
  •  隐瞒了意图╮
    2020-12-29 15:15

    I've ended up declaring the aspects in the spring's applicationContext xml config and removing the annotations.

    What was working so far was using the aspectj plugin for maven, but everytime I changed a class in eclipse, I had to run $ mvn compile (because eclipse doesn't know the aspects, and was compiling the classes without them), and that's an awful thing to say to anybody that will use MyAspect.

    Then I just created a config file and documented: to use MyAspect, just import this config rules to your spring's context configuration.

提交回复
热议问题