User Tools

Site Tools


java:dynamiclanguagesupport

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
java:dynamiclanguagesupport [2012/04/11 23:51]
rlunaro
java:dynamiclanguagesupport [2014/12/24 10:42] (current)
Line 1: Line 1:
 +====== Dynamic Language Support in Spring ======
 +
 +Spring [[http://​static.springsource.org/​spring/​docs/​2.5.x/​reference/​dynamic-language.html|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: ​
 +
 +[[http://​sourceforge.net/​projects/​aopalliance]]
 +
 +However **the '​default'​ file for download is an incorrect one:** an alpha version that doesn'​t work. [[http://​sourceforge.net/​projects/​aopalliance/​files/​aopalliance/​1.0/​|Look into the files section]] to get the latest version.
 +
 +===== java.lang.ClassNotFoundException:​ org.codehaus.groovy.control.CompilationFailedException =====
 +
 +You have to download [[http://​groovy.codehaus.org|Groovy]]. ​
 +
 +I made the following: ​
 +
 +  - Download Groovy (binary release)
 +  - Unzip the file and locate the "​embedable"​ directory in it: it contains a single jar file with all the groovy
 +  - Add it to your project
 +
 +===== Location is incorrect also =====
 +
 +Here is my working example of my --still very simple-- groovy bean: 
 +
 +<code xml>
 + <​lang:​groovy id="​customField"​
 + script-source="​classpath:​com/​supermanhamuerto/​nestor/​actions/​CustomFieldImpl.groovy"​
 + scope="​prototype">​
 + <​lang:​property name="​message"​ value="​Hello from groovy!!!!"/>​
 + </​lang:​groovy>​
 +</​code>​
 +
 +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: 2014/12/24 10:42 (external edit)