Skip to content

Latest commit

 

History

History
77 lines (56 loc) · 1.88 KB

README.textile

File metadata and controls

77 lines (56 loc) · 1.88 KB

Playing around with and trying to re-implement an old blog entry of Jonas Boner.

AspectJ Load Time Weaving

Some resources:

to enable load time weaving with maven surefire plugin use the following:

<plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <testFailureIgnore>true</testFailureIgnore>
        <forkMode>once</forkMode>
        <argLine>
            -javaagent:${user.home}/.m2/repository/org/aspectj/aspectjweaver/${aj.version}/aspectjweaver-${aj.version}.jar
        </argLine>
        <systemProperties>
            <property>
                <name>aj.weaving.verbose</name>
                <value>true</value>
            </property>
        </systemProperties>
    </configuration>
</plugin>

Aspects with Stackable Traits (current look)

Around Interception

"enable Around interception" in {

      val aspect = new Aspect("execution(* *.bar(..))")
              with LoggingInterceptor
              with TransactionInterceptor

      val foo = aspect.create[Foo](new FooImpl)

      foo.foo("foo")
      foo.bar("bar")

    }

Before Interception

    "enable Before interception" in {

      val aspect = new Aspect("execution(* *.bar(..))")
              with InterceptBefore

      val foo = aspect.create[Foo](new FooImpl)

      foo.foo("foo")
      foo.bar("bar")
    }

After Interception

    "enable After interception" in {
      val aspect = new Aspect("execution(* *.bar(..))")
              with InterceptAfter

      val foo = aspect.create[Foo](new FooImpl)

      foo.foo("foo")
      foo.bar("bar")
    }