Configuring Groovy and Aspectj Classes with the Spring Service Component
If you configure a Groovy or Aspectj class in the spring configuration file, you must follow these conventions:
-
Use the
classpathprotocol:script-source="classpath:"
Using a relative file path is not possible because the SCA package is not treated as a regular JAR file for the class loader. For example, the following
classpathprotocol indicates to find the Groovy file from the class path.script-source="classpath:service/GroovyGreeter.groovy"
-
Add Groovy and Aspectj files in any of the following directories when using the
classpathprotocol. No other directories are possible.-
SCA-INF/classes -
SCA-INF/lib -
Shared SOA
lib
If your build scripts are configured to clean the
classesdirectory, either put the Groovy files in theSCA-INF/libdirectory or design your build scripts to prevent cleaning. -
-
Add spring extension JAR file libraries for Groovy or Aspectj to the class path of the managed server's
setDomainENV.shorsetDomainENV.batfile and restart the server. This ensures that deployment is successful. The restart is required because spring uses Java reflection to instantiate aspect-oriented programming (AOP). The use of reflection restricts the search for classes to the system class loader. Any changes to the system class loader require a server restart.