Jour is designed to simplify the use of Javassist for processing multiple classes. In short Jour is simple Aspect Oriented Programming AOP framework on top of Javassist.
Forked from https://sourceforge.net/projects/jour/ and updated to support Java version 8 to 21.
<dependency>
<groupId>net.sf.jour</groupId>
<artifactId>jour</artifactId>
<version>2.1.1</version>
</dependency><dependency>
<groupId>net.sf.jour</groupId>
<artifactId>jour-instrument</artifactId>
<version>2.1.1</version>
</dependency><dependency>
<groupId>net.sf.jour</groupId>
<artifactId>jour-maven-plugin</artifactId>
<version>2.1.1</version>
</dependency>In general the way to use jour is to define a jour.xml file with aspects which define how your code can be instrumented either using your own implementation of net.sf.jour.instrumentor.Instrumentor, or by using one of the included implementations:
- net.sf.jour.instrumentor.MethodExecutionTimeInstrumentor
- net.sf.jour.instrumentor.ExceptionCatcherInstrumentor
- net.sf.jour.instrumentor.MakeEmptyMethodInstrumentor
- net.sf.jour.instrumentor.ReplaceMethodInstrumentor
For example:
<jour>
<aspect type="net.sf.jour.instrumentor.MakeEmptyMethodInstrumentor">
<typedef>com.example.*</typedef>
<pointcut expr="* debug*(..)"/>
</aspect>
<aspect type="net.sf.jour.instrumentor.ReplaceMethodInstrumentor">
<typedef>com.example.*</typedef>
<pointcut expr="java.lang.String replaceMe(..)"/>
<property name="code">
<value><![CDATA[
{
return "replacement implementation";
}
]]></value>
</property>
</aspect>
</jour>For more information about how to use jour-instrument please see: http://jour.sourceforge.net/instrumentation.html