» Articles » java category listing.

get rid of groovy recompilation

Compilation time for a groovy script adds a relatively high overhead to the running time of an application that is supposed to run very often. Granted, the GroovyScriptEngine does on-demand recompilation, but the compilation units don’t survive a restart.

I’m working on a project that contains a little command line application that is supposed to run very often. Every overhead adds up costs very quickly. I’ve measured more than a second overhead to compile two very small groovy scripts.

In this entry, we will create a mechanism that stores compiled groovy classes in a temporary directory and reuses them if none of the scripts have any changes.


How to scan for annotated classes and instantiate them

You may have been faced with the following problem: Let’s say you have a system that provides a couple of neat features out of the box, but you want to provide some means for the end user to extend the system, without having to release a new version that incorporates what your users have added (maybe because those additions are too exotic, or you just don’t like it).


using groovy 'scriptlets' in java

My goal is to ‘outsource’ parts of a java application into groovy scriptlets, and have the main program (written in java) load those scriptlets and execute them in a predefined fashion.


apache velocity tricks

The apache velocity template engine comes with a relatively simple yet very powerful DSL, the velocity template language (VTL). The language is more powerful than you may think. This entry will show you two less known but very handy velocity tricks.