User Tools

Site Tools


Dynamic Language Support in Spring

Spring supports the use of scripts. In other words, create a bean in Groovy, Jruby and call it as a normal bean from our application.

However, when I tried to use this feature of Spring, even with the last up-to-date version (3.1.1), many errors arise, due to the lack of proper libraries.

Many forums recall to the use of Maven to download properly these missing jars, but I don't want to use it. Other forums give solutions that are not solutions at all, so I've decided to collect these notes.

java.lang.ClassNotFoundException: org.aopalliance.aop.Advice

You can find this missing class in this sourceforge project:

However the 'default' file for download is an incorrect one: an alpha version that doesn't work. Look into the files section to get the latest version.

java.lang.ClassNotFoundException: org.codehaus.groovy.control.CompilationFailedException

You have to download Groovy.

I made the following:

  1. Download Groovy (binary release)
  2. Unzip the file and locate the “embedable” directory in it: it contains a single jar file with all the groovy
  3. Add it to your project

Location is incorrect also

Here is my working example of my –still very simple– groovy bean:

	<lang:groovy id="customField"
		<lang:property name="message" value="Hello from groovy!!!!"/>

If you have put your script into the package “com.supermanhamuerto.nestor.actions”, you must specify the complete path into the script-source attribute.

java/dynamiclanguagesupport.txt · Last modified: 2022/12/02 22:02 by