JavaZone-Code-Injection

Code for my Code Injection presentation on JavaZone 2011

EPL-1.0 License

Stars
13

Code for my presentation of code injection at JavaZone 2011

Get the code, run it and look for 'THE INJECTED CODE SAYS:' in its output.

= Getting the code = Point your browser to https://github.com/jakubholynet/JavaZone-Code-Injection/zipball/master and a ZIP archive download should start.

= Running the examples with Maven = I've been using Maven 2.2.1. cd /path/into/the/downloaded/folder/where/pom.xml/is

  1. Java Proxy:
    mvn -P javaproxy test
  2. Javassist:
    mvn -P javassist test
  3. AspectJ:
    mvn -P aspectj test

= Running the examples manually =

  • Get the dependencies described in pom.xml and their transitive dependencies
  • Compile the sources
  • Run them:
    *# Java Proxy:
    *## java -classpath <the dependencies listed below:/path/to/classes> iterate.jz2011.codeinjection.javaproxy.Main
    *# Javassist:
    *## java -classpath /path/to/javassist-3.14.0-GA.jar:/path/to/classes iterate.jz2011.codeinjection.javassist.JavassistInstrumenter
    *## java -classpath target/javassist:/path/to/classes iterate.jz2011.codeinjection.javassist.Main
    *# AspectJ:
    *## In aspectj-inject-build.xml define maven.plugin.classpath as described
    *## ant -f aspectj-inject-build.xml
    *## java -classpath "/path/to/classes:/path/to/aspectjrt-1.6.10.jar" iterate.jz2011.codeinjection.aspectj.Main

Dependencies for the Java Proxy example: +- net.jakubholy.testing:dbunit-embeddedderby-parenttest🫙1.2.0:compile | +- org.apache.derby:derby🫙10.3.2.1:compile | +- org.dbunit:dbunit🫙2.4.7:compile | | - commons-collections:commons-collections🫙3.2.1:compile | +- junit:junit🫙3.8.2:compile | - org.slf4j:slf4j-api🫙1.5.6:compile - org.slf4j:slf4j-simple🫙1.5.6:runtime

= License = The code is in the public domain and fully available for any use, i.e. no licensing issues.

= Copyleft = Jakub Holy of Iterate AS, 2011