If you use the Groovy class as a Spring bean, you donβt need the <lang: groovy> tag at all. Just expand your compiled class as if it were Java, and it should only work as long as you include the groovy -all jar file as a project dependency.
The <lang: groovy> tag with the script source is for "updated" beans. This is where you deploy the source code (not the compiled version), and Spring detects changes and recompilations for you. This is how you can update the code in a running application, which is very cool, but rather rare.
If all you want to do is write your implementation classes in Groovy, just compile them as usual and add them to your JavaConfig files just like any other bean. They are all bytecodes in Spring.
source share