Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
java
java
package testAOP;

public class HelloWorld {

    public static void main(String args[]) {
        HelloWorld world = new HelloWorld();
        System.out.println(world.greet());
    }

    public String greet() {
        return System.out.println("Hello World!");
    }
}

This is simply a standard Java application, and can be compiled with javac -d target HelloWorld.java

...

Code Block
before greeting...
Hello World!
after greeting...
Hello World!

NOTE: TUTORIAL BEEING UPDATED TO HAVE A MORE INTUITIVE OUTPUT

Using offline weaving

With offline weaving, the test applications classes are modified on the disk with the aspect calls. That is to say offline weaving amends your actual class definition, (as opposed to online weaving which doesn't modify any classes). To perform offline weaving, you use the aspectwerkz command line tool with the -offline option, as follows:

...

Code Block
before greeting...
Hello World!
after greeting...
Hello World!

NOTE: TUTORIAL BEEING UPDATED TO HAVE A MORE INTUITIVE OUTPUT

Conclusion

Now we have learned how to:

...