{"id":6701,"date":"2013-01-08T22:00:54","date_gmt":"2013-01-08T20:00:54","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=6701"},"modified":"2013-01-08T05:59:42","modified_gmt":"2013-01-08T03:59:42","slug":"spring-dynamic-language-support-with-groovy","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html","title":{"rendered":"Spring Dynamic Language Support with Groovy"},"content":{"rendered":"<p>Groovy is a dynamic and object-oriented programming language running on JVM. It uses a syntax like Java, can be embedded in Java and is compiled to byte-code. Java code can be called from Groovy, and vice versa. Some of Groovy features are Meta and Functional programming, Dynamic typing (with the def keyword), Closures, GroovyBeans, Groovlets, integration with Bean Scripting Framework(BSF), Generics, Anotation and Collection Support.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\nThis article explains fundamental Spring Dynamic Language Support for Groovy via the following ways :<\/p>\n<ol>\n<li>By using <strong>Java syntax<\/strong> and Spring Stereotype,<\/li>\n<li>By using <strong>Groovy syntax<\/strong> and Spring Stereotype,<\/li>\n<li>By using <strong>inline-script feature<\/strong>,<\/li>\n<li>By using <strong>Spring Groovy language support(lang:groovy)<\/strong>.<\/li>\n<\/ol>\n<h4>Used Technologies :<\/h4>\n<ul>\n<li>JDK 1.7.0_09<\/li>\n<li>Spring 3.2.0<\/li>\n<li>Groovy 2.0.4<\/li>\n<li>Maven 3.0.4<\/li>\n<\/ul>\n<h2>STEP 1 : CREATE MAVEN PROJECT<\/h2>\n<p>A maven project is created as below. (It can be created by using Maven or IDE Plug-in).<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/How-to-integrate-Spring-and-Groovy2.png\"><img decoding=\"async\" class=\"aligncenter\" title=\"How to integrate Spring and Groovy\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/How-to-integrate-Spring-and-Groovy2.png\" alt=\"\" width=\"298\" height=\"433\" \/><\/a><\/p>\n<h2>STEP 2 : LIBRARIES<\/h2>\n<p>Firstly, dependencies are added to Maven\u2019 s pom.xml.<\/p>\n<pre class=\" brush:xml\">\t&lt;properties&gt;\r\n\t\t&lt;project.build.sourceEncoding&gt;UTF-8&lt;\/project.build.sourceEncoding&gt;\r\n\t\t&lt;spring.version&gt;3.2.0.RELEASE&lt;\/spring.version&gt;\r\n\t&lt;\/properties&gt;\t\r\n\r\n\t&lt;!-- Spring 3 dependencies --&gt;\r\n\t&lt;dependency&gt;\r\n\t\t&lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n\t\t&lt;artifactId&gt;spring-core&lt;\/artifactId&gt;\r\n\t\t&lt;version&gt;${spring.version}&lt;\/version&gt;\r\n\t&lt;\/dependency&gt;\r\n\r\n\t&lt;dependency&gt;\r\n\t\t&lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n\t\t&lt;artifactId&gt;spring-context&lt;\/artifactId&gt;\r\n\t\t&lt;version&gt;${spring.version}&lt;\/version&gt;\r\n\t&lt;\/dependency&gt;\r\n\r\n\t&lt;dependency&gt;\r\n\t\t&lt;groupId&gt;org.codehaus.groovy&lt;\/groupId&gt;\r\n\t\t&lt;artifactId&gt;groovy-all&lt;\/artifactId&gt;\r\n\t\t&lt;version&gt;2.0.4&lt;\/version&gt;\r\n\t&lt;\/dependency&gt;<\/pre>\n<p>maven-compiler-plugin(Maven Plugin) is used to compile the project with JDK 1.7<\/p>\n<pre class=\" brush:xml\">\t&lt;plugin&gt;\r\n\t\t&lt;artifactId&gt;maven-compiler-plugin&lt;\/artifactId&gt;\r\n\t\t&lt;version&gt;2.3.2&lt;\/version&gt;\r\n\t\t&lt;configuration&gt;\r\n\t\t\t&lt;compilerId&gt;groovy-eclipse-compiler&lt;\/compilerId&gt;\r\n\t\t\t&lt;verbose&gt;true&lt;\/verbose&gt;\r\n\t\t\t&lt;source&gt;1.7&lt;\/source&gt;\r\n\t\t\t&lt;target&gt;1.7&lt;\/target&gt;\r\n\t\t\t&lt;encoding&gt;${project.build.sourceEncoding}&lt;\/encoding&gt;\r\n\t\t&lt;\/configuration&gt;\r\n\t\t&lt;dependencies&gt;\r\n\t\t\t&lt;dependency&gt;\r\n\t\t\t\t&lt;groupId&gt;org.codehaus.groovy&lt;\/groupId&gt;\r\n\t\t\t\t&lt;artifactId&gt;groovy-eclipse-compiler&lt;\/artifactId&gt;\r\n\t\t\t\t&lt;version&gt;2.6.0-01&lt;\/version&gt;\r\n\t\t\t&lt;\/dependency&gt;\r\n\t\t&lt;\/dependencies&gt;\r\n\t&lt;\/plugin&gt;<\/pre>\n<p>maven-shade-plugin(Maven Plugin) can be used to create runnable-jar<\/p>\n<pre class=\" brush:xml\">\t&lt;plugin&gt;\r\n\t\t&lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\r\n\t\t&lt;artifactId&gt;maven-shade-plugin&lt;\/artifactId&gt;\r\n\t\t&lt;version&gt;2.0&lt;\/version&gt;\r\n\r\n\t\t&lt;executions&gt;\r\n\t\t\t&lt;execution&gt;\r\n\t\t\t\t&lt;phase&gt;package&lt;\/phase&gt;\r\n\t\t\t\t&lt;goals&gt;\r\n\t\t\t\t\t&lt;goal&gt;shade&lt;\/goal&gt;\r\n\t\t\t\t&lt;\/goals&gt;\r\n\t\t\t\t&lt;configuration&gt;\r\n\t\t\t\t\t&lt;createDependencyReducedPom&gt;false&lt;\/createDependencyReducedPom&gt;\r\n\t\t\t\t\t&lt;configuration&gt;\r\n\t\t\t\t\t\t&lt;source&gt;1.7&lt;\/source&gt;\r\n\t\t\t\t\t\t&lt;target&gt;1.7&lt;\/target&gt;\r\n\t\t\t\t\t&lt;\/configuration&gt;\r\n\t\t\t\t\t&lt;transformers&gt;\r\n\t\t\t\t\t\t&lt;transformer\r\n\t\t\t\t\t\t\timplementation='org.apache.maven.plugins.shade.resource.ManifestResourceTransformer'&gt;\r\n\t\t\t\t\t\t\t&lt;mainClass&gt;com.onlinetechvision.exe.Application&lt;\/mainClass&gt;\r\n\t\t\t\t\t\t&lt;\/transformer&gt;\r\n\t\t\t\t\t\t&lt;transformer\r\n\t\t\t\t\t\t\timplementation='org.apache.maven.plugins.shade.resource.AppendingTransformer'&gt;\r\n\t\t\t\t\t\t\t&lt;resource&gt;META-INF\/spring.handlers&lt;\/resource&gt;\r\n\t\t\t\t\t\t&lt;\/transformer&gt;\r\n\t\t\t\t\t\t&lt;transformer\r\n\t\t\t\t\t\t\timplementation='org.apache.maven.plugins.shade.resource.AppendingTransformer'&gt;\r\n\t\t\t\t\t\t\t&lt;resource&gt;META-INF\/spring.schemas&lt;\/resource&gt;\r\n\t\t\t\t\t\t&lt;\/transformer&gt;\r\n\t\t\t\t\t&lt;\/transformers&gt;\r\n\t\t\t\t&lt;\/configuration&gt;\r\n\t\t\t&lt;\/execution&gt;\r\n\t\t&lt;\/executions&gt;\r\n\t&lt;\/plugin&gt;<\/pre>\n<p><strong>STEP 3 : CREATE Employee CLASS<\/strong><\/p>\n<p><strong>Employee<\/strong> Bean is created.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.employee;\r\n\r\n\/**\r\n * Employee Bean\r\n *\r\n * @author onlinetechvision.com\r\n * @since 24 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\npublic class Employee {\r\n\r\n\tprivate String id;\r\n\tprivate String name;\r\n\tprivate String surname;\r\n\r\n\tpublic Employee(String id, String name, String surname) {\r\n\t\tthis.id = id;\r\n\t\tthis.name = name;\r\n\t\tthis.surname = surname;\r\n\t}\r\n\r\n\tpublic String getId() {\r\n\t\treturn id;\r\n\t}\r\n\r\n\tpublic void setId(String id) {\r\n\t\tthis.id = id;\r\n\t}\r\n\r\n\tpublic String getName() {\r\n\t\treturn name;\r\n\t}\r\n\r\n\tpublic void setName(String name) {\r\n\t\tthis.name = name;\r\n\t}\r\n\r\n\tpublic String getSurname() {\r\n\t\treturn surname;\r\n\t}\r\n\r\n\tpublic void setSurname(String surname) {\r\n\t\tthis.surname = surname;\r\n\t}\t\r\n\r\n\t@Override\r\n\tpublic int hashCode() {\r\n\t\tfinal int prime = 31;\r\n\t\tint result = 1;\r\n\t\tresult = prime * result + ((id == null) ? 0 : id.hashCode());\r\n\t\tresult = prime * result + ((name == null) ? 0 : name.hashCode());\r\n\t\tresult = prime * result + ((surname == null) ? 0 : surname.hashCode());\r\n\t\treturn result;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic boolean equals(Object obj) {\r\n\t\tif (this == obj)\r\n\t\t\treturn true;\r\n\t\tif (obj == null)\r\n\t\t\treturn false;\r\n\t\tif (getClass() != obj.getClass())\r\n\t\t\treturn false;\r\n\t\tEmployee other = (Employee) obj;\r\n\t\tif (id == null) {\r\n\t\t\tif (other.id != null)\r\n\t\t\t\treturn false;\r\n\t\t} else if (!id.equals(other.id))\r\n\t\t\treturn false;\r\n\t\tif (name == null) {\r\n\t\t\tif (other.name != null)\r\n\t\t\t\treturn false;\r\n\t\t} else if (!name.equals(other.name))\r\n\t\t\treturn false;\r\n\t\tif (surname == null) {\r\n\t\t\tif (other.surname != null)\r\n\t\t\t\treturn false;\r\n\t\t} else if (!surname.equals(other.surname))\r\n\t\t\treturn false;\r\n\t\treturn true;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic String toString() {\r\n\t\treturn 'Employee [id=' + id\r\n\t\t\t\t            + ', name=' + name\r\n\t\t\t\t\t\t\t+ ', surname=' + surname + ']';\r\n\t}\t\r\n\r\n}<\/pre>\n<h4>METHOD 1 : USING JAVA SYNTAX<\/h4>\n<h2>STEP 4 : CREATE IGroovyEmployeeCacheService INTERFACE<\/h2>\n<p><strong>IGroovyEmployeeCacheService<\/strong> Interface is created to expose Groovy Cache functionality.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.groovy.srv\r\n\r\nimport com.onlinetechvision.employee.Employee\r\n\r\n\/**\r\n * IGroovyEmployeeCacheService Interface exposes cache functionality.\r\n *\r\n * @author onlinetechvision.com\r\n * @since 24 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\ninterface IGroovyEmployeeCacheService {\r\n\r\n\t\/**\r\n\t * Adds employee entry to cache\r\n\t *\r\n\t * @param Employee employee\r\n\t *\r\n\t *\/\r\n\tvoid addToEmployeeCache(Employee employee);\r\n\r\n\t\/**\r\n\t * Gets employee entry from cache\r\n\t *\r\n\t * @param String id\r\n\t * @return Employee employee\r\n\t *\/\r\n\tEmployee getFromEmployeeCache(String id);\r\n\r\n\t\/**\r\n\t * Removes employee entry from cache\r\n\t *\r\n\t * @param Employee employee\r\n\t *\r\n\t *\/\r\n\tvoid removeFromEmployeeCache(Employee employee);\r\n\r\n}<\/pre>\n<h2>STEP 5 : CREATE GroovyEmployeeCacheService IMPL<\/h2>\n<p><strong>GroovyEmployeeCacheService<\/strong> Class is created by implementing <strong>IGroovyEmployeeCacheService<\/strong> Interface.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.groovy.srv\r\n\r\nimport com.onlinetechvision.employee.Employee;\r\nimport org.springframework.stereotype.Service;\r\n\r\n\/**\r\n * GroovyEmployeeCacheService Class is implementation of IGroovyEmployeeCacheService Interface.\r\n *\r\n * @author onlinetechvision.com\r\n * @since 24 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\n@Service\r\nclass GroovyEmployeeCacheService implements IGroovyEmployeeCacheService  {\r\n\r\n\tprivate Map&lt;String, Employee&gt; cache = new HashMap();\r\n\r\n\t\/**\r\n\t * Adds employee entry to cache\r\n\t *\r\n\t * @param Employee employee\r\n\t *\r\n\t *\/\r\n\tpublic void addToEmployeeCache(Employee employee) {\r\n\t\tgetCache().put(employee.getId(), employee);\r\n\t\tprintln print(employee, 'added to cache...');\r\n\t}\r\n\r\n\t\/**\r\n\t * Gets employee entry from cache\r\n\t *\r\n\t * @param String id\r\n\t * @return Employee employee\r\n\t *\/\r\n\tpublic Employee getFromEmployeeCache(String id) {\r\n\t\tEmployee employee = getCache().get(id);\r\n\t\tprintln print(employee, 'gotten from cache...');\r\n\t\treturn employee;\r\n\t}\r\n\r\n\t\/**\r\n\t * Removes employee entry from cache\r\n\t *\r\n\t * @param Employee employee\r\n\t *\r\n\t *\/\r\n\tpublic void removeFromEmployeeCache(Employee employee) {\r\n\t\tgetCache().remove(employee.getId());\r\n\t\tprintln print(employee, 'removed from cache...');\r\n\t\tprintln 'Groovy Cache Entries :' + getCache();\r\n\t}\r\n\r\n\tpublic Map&lt;String, Employee&gt; getCache() {\r\n\t\treturn cache;\r\n\t}\r\n\r\n\tpublic void setCache(Map&lt;String, Employee&gt; map) {\r\n\t\tcache = map;\r\n\t}\r\n\r\n\t\/**\r\n\t * Prints operation information\r\n\t *\r\n\t * @param Employee employee\r\n\t * @param String description\r\n\t *\r\n\t *\/\r\n\tprivate String print(Employee employee, String desc) {\r\n\t\tStringBuilder strBldr = new StringBuilder();\r\n\t\tstrBldr.append(employee)\r\n\t\tstrBldr.append(' ');\r\n\t\tstrBldr.append(desc);\r\n\r\n\t\treturn strBldr.toString();\r\n\t}\r\n}<\/pre>\n<h2>STEP 6 : CREATE IEmployeeService INTERFACE<\/h2>\n<p><strong>IUserService<\/strong> Interface is created for Spring service layer and shows how to integrate Spring and Groovy Service layers.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.spring.srv;\r\n\r\nimport com.onlinetechvision.employee.Employee;\r\n\r\n\/**\r\n * IEmployeeService Interface is created to represent Spring Service layer.\r\n *\r\n * @author onlinetechvision.com\r\n * @since 24 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\npublic interface IEmployeeService {\r\n\r\n\t\/**\r\n\t * Adds Employee entry to cache\r\n\t *\r\n\t * @param Employee employee\r\n\t *\r\n\t *\/\r\n\tvoid addToGroovyEmployeeCache(Employee employee);\r\n\r\n\t\/**\r\n\t * Gets Employee entry from cache\r\n\t *\r\n\t * @param String id\r\n\t * @return Employee employee\r\n\t *\/\r\n\tEmployee getFromGroovyEmployeeCache(String id);\r\n\r\n\t\/**\r\n\t * Removes Employee entry from cache\r\n\t *\r\n\t * @param Employee employee\r\n\t *\r\n\t *\/\r\n\tvoid removeFromGroovyEmployeeCache(Employee employee);\t\r\n\r\n}<\/pre>\n<h2>STEP 7 : CREATE EmployeeService IMPL<\/h2>\n<p><strong>EmployeeService<\/strong> Class is created by implementing <strong>IUserService<\/strong> Interface.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.spring.srv;\r\n\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.stereotype.Service;\r\n\r\nimport com.onlinetechvision.employee.Employee;\r\nimport com.onlinetechvision.groovy.srv.IGroovyEmployeeCacheService;\r\n\r\n\/**\r\n * EmployeeService Class is implementation of IEmployeeService interface.\r\n *\r\n * @author onlinetechvision.com\r\n * @since 24 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\n@Service\r\npublic class EmployeeService implements IEmployeeService {\r\n\r\n\t@Autowired\r\n\tprivate IGroovyEmployeeCacheService groovyEmployeeCacheService ;\r\n\r\n\t\/**\r\n\t * Adds Employee entry to cache\r\n\t *\r\n\t * @param Employee employee\r\n\t *\r\n\t *\/\r\n\tpublic void addToGroovyEmployeeCache(Employee employee) {\r\n\t\tgetGroovyEmployeeCacheService().addToEmployeeCache(employee);\r\n\t}\r\n\r\n\t\/**\r\n\t * Gets Employee entry from cache\r\n\t *\r\n\t * @param String id\r\n\t * @return Employee employee\r\n\t *\/\r\n\tpublic Employee getFromGroovyEmployeeCache(String id) {\r\n\t\treturn getGroovyEmployeeCacheService().getFromEmployeeCache(id);\r\n\t}\t\r\n\r\n\t\/**\r\n\t * Removes Employee entry from cache\r\n\t *\r\n\t * @param Employee employee\r\n\t *\r\n\t *\/\r\n\tpublic void removeFromGroovyEmployeeCache(Employee employee) {\r\n\t\tgetGroovyEmployeeCacheService().removeFromEmployeeCache(employee);\r\n\t}\r\n\r\n\tpublic IGroovyEmployeeCacheService getGroovyEmployeeCacheService() {\r\n\t\treturn groovyEmployeeCacheService;\r\n\t}\r\n\r\n\tpublic void setGroovyEmployeeCacheService(IGroovyEmployeeCacheService groovyEmployeeCacheService) {\r\n\t\tthis.groovyEmployeeCacheService = groovyEmployeeCacheService;\r\n\t}\t\r\n\r\n}<\/pre>\n<h2>STEP 8 : CREATE applicationContext.xml<\/h2>\n<p>Spring Configuration file, <strong>applicationContext.xml<\/strong>, is created.<\/p>\n<pre class=\" brush:xml\">&lt;beans xmlns='http:\/\/www.springframework.org\/schema\/beans'\r\n\txmlns:xsi='http:\/\/www.w3.org\/2001\/XMLSchema-instance'\r\n\txmlns:context='http:\/\/www.springframework.org\/schema\/context'\r\n\txsi:schemaLocation='http:\/\/www.springframework.org\/schema\/beans\r\n\r\nhttp:\/\/www.springframework.org\/schema\/beans\/spring-beans-3.0.xsd\r\n\r\nhttp:\/\/www.springframework.org\/schema\/context\r\n\r\nhttp:\/\/www.springframework.org\/schema\/context\/spring-context-3.0.xsd'&gt;\r\n\r\n\t&lt;context:component-scan base-package='com.onlinetechvision.spring.srv, com.onlinetechvision.groovy.srv'\/&gt;\r\n\r\n&lt;\/beans&gt;<\/pre>\n<h2>STEP 9 : CREATE Application CLASS<\/h2>\n<p><strong>Application<\/strong> Class is created to run the application.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.exe;\r\n\r\nimport org.springframework.context.ApplicationContext;\r\nimport org.springframework.context.support.ClassPathXmlApplicationContext;\r\n\r\nimport com.onlinetechvision.spring.srv.EmployeeService;\r\nimport com.onlinetechvision.spring.srv.IEmployeeService;\r\nimport com.onlinetechvision.employee.Employee;\r\n\r\n\/**\r\n * Application Class starts the application\r\n *\r\n * @author onlinetechvision.com\r\n * @since 24 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\npublic class Application\r\n{\r\n\t\/**\r\n     * Starts the application\r\n     *\r\n     * @param  String[] args\r\n     *\r\n     *\/\r\n\tpublic static void main(String[] args) {\r\n\t\tApplicationContext context = new ClassPathXmlApplicationContext('applicationContext.xml');\r\n\r\n\t\tIEmployeeService employeeService = (IEmployeeService) context.getBean(EmployeeService.class);\r\n\r\n\t\tEmployee firstEmployee = new Employee('1', 'Jake', 'Gyllenhaal');\r\n\t\tEmployee secondEmployee = new Employee('2', 'Woody', 'Harrelson');\r\n\r\n\t\temployeeService.addToGroovyEmployeeCache(firstEmployee);\r\n\t\temployeeService.getFromGroovyEmployeeCache(firstEmployee.getId());\r\n\t\temployeeService.removeFromGroovyEmployeeCache(firstEmployee);\r\n\r\n\t\temployeeService.addToGroovyEmployeeCache(secondEmployee);\r\n\t\temployeeService.getFromGroovyEmployeeCache(secondEmployee.getId());\r\n\t}\r\n\r\n}<\/pre>\n<h2>STEP 10 : BUILD PROJECT<\/h2>\n<p>After <strong>OTV_Spring_Groovy<\/strong> Project is build, <strong>OTV_Spring_Groovy-0.0.1-SNAPSHOT.jar<\/strong> is created.<\/p>\n<h2>STEP 11 : RUN PROJECT<\/h2>\n<p>After created <strong>OTV_Spring_Groovy-0.0.1-SNAPSHOT.jar<\/strong> file is run, output logs are shown as the followwing :<\/p>\n<pre class=\" brush:bash\">Employee [id=1, name=Jake, surname=Gyllenhaal] added to cache...\r\nEmployee [id=1, name=Jake, surname=Gyllenhaal] gotten from cache...\r\nEmployee [id=1, name=Jake, surname=Gyllenhaal] removed from cache...\r\nGroovy Cache Entries :[:]\r\n\r\nEmployee [id=2, name=Woody, surname=Harrelson] added to cache...\r\nEmployee [id=2, name=Woody, surname=Harrelson] gotten from cache...<\/pre>\n<p>So far, first way has been explained. Let us take a look to the other ways :<\/p>\n<h4>METHOD 2 : USING GROOVY SYNTAX<\/h4>\n<p><strong>IGroovyEmployeeCacheService<\/strong> Interface and <strong>GroovyEmployeeCacheService<\/strong> Impl can be also designed by using Groovy syntax as the following :<\/p>\n<h2>STEP 12.1 : CREATE IGroovyEmployeeCacheService INTERFACE<\/h2>\n<p><strong>IGroovyEmployeeCacheService<\/strong> Interface is created by using Groovy syntax.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.groovy.srv\r\n\r\nimport com.onlinetechvision.employee.Employee\r\n\r\n\/**\r\n * IGroovyEmployeeCacheService Interface exposes cache functionality.\r\n *\r\n * @author onlinetechvision.com\r\n * @since 24 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\ninterface IGroovyEmployeeCacheService {\r\n\r\n\t\/**\r\n\t * Adds employee entry to cache\r\n\t *\r\n\t * @param Employee employee\r\n\t *\r\n\t *\/\r\n\tdef addToEmployeeCache(Employee employee);\r\n\r\n\t\/**\r\n\t * Gets employee entry from cache\r\n\t *\r\n\t * @param String id\r\n\t * @return Employee employee\r\n\t *\/\r\n\tdef getFromEmployeeCache(String id);\r\n\r\n\t\/**\r\n\t * Removes employee entry from cache\r\n\t *\r\n\t * @param Employee employee\r\n\t *\r\n\t *\/\r\n\tdef removeFromEmployeeCache(Employee employee);\r\n\r\n}<\/pre>\n<h2>STEP 12.2 : CREATE GroovyEmployeeCacheService IMPL<\/h2>\n<p><strong>GroovyEmployeeCacheService<\/strong> Class is created by using Groovy syntax.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.groovy.srv\r\n\r\nimport com.onlinetechvision.employee.Employee;\r\nimport org.springframework.stereotype.Service;\r\n\r\n\/**\r\n * GroovyEmployeeCacheService Class is implementation of IGroovyEmployeeCacheService Interface.\r\n *\r\n * @author onlinetechvision.com\r\n * @since 24 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\n@Service\r\nclass GroovyEmployeeCacheService implements IGroovyEmployeeCacheService  {\r\n\r\n\tdef cache = new HashMap();\r\n\r\n\t\/**\r\n\t * Adds employee entry to cache\r\n\t *\r\n\t * @param Employee employee\r\n\t *\r\n\t *\/\r\n\tdef addToEmployeeCache(Employee employee) {\r\n\t\tgetCache().put(employee.getId(), employee);\r\n\t\tprintln print(employee, 'added to cache...');\r\n\t}\r\n\r\n\t\/**\r\n\t * Gets employee entry from cache\r\n\t *\r\n\t * @param String id\r\n\t * @return Employee employee\r\n\t *\/\r\n\tdef getFromEmployeeCache(String id) {\r\n\t\tEmployee employee = getCache().get(id);\r\n\t\tprintln print(employee, 'gotten from cache...');\r\n\t\treturn employee;\r\n\t}\r\n\r\n\t\/**\r\n\t * Removes employee entry from cache\r\n\t *\r\n\t * @param Employee employee\r\n\t *\r\n\t *\/\r\n\tdef removeFromEmployeeCache(Employee employee) {\r\n\t\tgetCache().remove(employee.getId());\r\n\t\tprintln print(employee, 'removed from cache...');\r\n\t\tprintln 'Groovy Cache Entries :' + getCache();\r\n\t}\r\n\r\n\tdef getCache() {\r\n\t\treturn cache;\r\n\t}\r\n\r\n\tdef setCache(Map&lt;String, Employee&gt; map) {\r\n\t\tcache = map;\r\n\t}\r\n\r\n\t\/**\r\n\t * Prints operation information\r\n\t *\r\n\t * @param Employee employee\r\n\t * @param String description\r\n\t *\r\n\t *\/\r\n\tdef print(Employee employee, String desc) {\r\n\t\tStringBuilder strBldr = new StringBuilder();\r\n\t\tstrBldr.append(employee)\r\n\t\tstrBldr.append(' ');\r\n\t\tstrBldr.append(desc);\r\n\t}\r\n}<\/pre>\n<h4>METHOD 3 : USING INLINE-SCRIPT FEATURE<\/h4>\n<p><strong>GroovyEmployeeCacheService<\/strong> Impl can be also defined by using inline-script feature as the following :<\/p>\n<h2>STEP 13.1 : DEFINE GroovyEmployeeCacheService IMPL via applicationContext.xml<\/h2>\n<p><strong>GroovyEmployeeCacheService<\/strong> Impl Class can be defined in <strong>applicationContext.xml<\/strong>.<\/p>\n<pre class=\" brush:xml\">&lt;beans xmlns='http:\/\/www.springframework.org\/schema\/beans'\r\n\txmlns:xsi='http:\/\/www.w3.org\/2001\/XMLSchema-instance'\r\n\txmlns:context='http:\/\/www.springframework.org\/schema\/context'\r\n\txmlns:lang='http:\/\/www.springframework.org\/schema\/lang'\r\n\txsi:schemaLocation='http:\/\/www.springframework.org\/schema\/beans\r\n\r\nhttp:\/\/www.springframework.org\/schema\/beans\/spring-beans-3.0.xsd\r\n\r\nhttp:\/\/www.springframework.org\/schema\/context\r\n\r\nhttp:\/\/www.springframework.org\/schema\/context\/spring-context-3.0.xsd\r\n\r\nhttp:\/\/www.springframework.org\/schema\/lang\r\n\r\nhttp:\/\/www.springframework.org\/schema\/lang\/spring-lang-3.0.xsd'&gt;\r\n\r\n\t&lt;context:component-scan base-package='com.onlinetechvision.spring.srv'\/&gt;\r\n\r\n\t&lt;lang:groovy id='groovyEmployeeCacheService'&gt;\r\n\t    &lt;lang:inline-script&gt;\r\n\t\t\tpackage com.onlinetechvision.groovy.srv\r\n\r\n\t\t\timport com.onlinetechvision.employee.Employee;\r\n\t\t\timport org.springframework.stereotype.Service;\r\n\r\n\t\t\tclass GroovyEmployeeCacheService implements IGroovyEmployeeCacheService {\r\n\r\n\t\t\t\tdef cache = new HashMap();\r\n\r\n\t\t\t\tdef addToEmployeeCache(Employee employee) {\r\n\t\t\t\t\tgetCache().put(employee.getId(), employee);\r\n\t\t\t\t\tprintln print(employee, 'added to cache...');\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdef getFromEmployeeCache(String id) {\r\n\t\t\t\t\tEmployee employee = getCache().get(id);\r\n\t\t\t\t\tprintln print(employee, 'gotten from cache...');\r\n\t\t\t\t\treturn employee;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdef removeFromEmployeeCache(Employee employee) {\r\n\t\t\t\t\tgetCache().remove(employee.getId());\r\n\t\t\t\t\tprintln print(employee, 'removed from cache...');\r\n\t\t\t\t\tprintln 'Groovy Cache Entities :' + getCache();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdef getCache() {\r\n\t\t\t\t\treturn cache;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdef setCache(Map map) {\r\n\t\t\t\t\tcache = map;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdef print(Employee employee, String desc) {\r\n\t\t\t\t\tStringBuilder strBldr = new StringBuilder();\r\n\t\t\t\t\tstrBldr.append(employee)\r\n\t\t\t\t\tstrBldr.append(' ');\r\n\t\t\t\t\tstrBldr.append(desc);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t    &lt;\/lang:inline-script&gt;\r\n\t&lt;\/lang:groovy&gt;\r\n\r\n&lt;\/beans&gt;<\/pre>\n<h4>METHOD 4 : USING SPRING GROOVY LANGUAGE SUPPORT<\/h4>\n<p><strong>GroovyEmployeeCacheService<\/strong> Impl can be also defined to Spring application-context without using stereotype(@Service) as the following :<\/p>\n<h2>STEP 14.1 : DEFINE GroovyEmployeeCacheService IMPL via applicationContext.xml<\/h2>\n<p><strong>GroovyEmployeeCacheService<\/strong> Impl Class can be defined in applicationContext.xml.<\/p>\n<pre class=\" brush:xml\">&lt;beans xmlns='http:\/\/www.springframework.org\/schema\/beans'\r\n\txmlns:xsi='http:\/\/www.w3.org\/2001\/XMLSchema-instance'\r\n\txmlns:context='http:\/\/www.springframework.org\/schema\/context'\r\n\txmlns:lang='http:\/\/www.springframework.org\/schema\/lang'\r\n\txsi:schemaLocation='http:\/\/www.springframework.org\/schema\/beans\r\n\r\nhttp:\/\/www.springframework.org\/schema\/beans\/spring-beans-3.0.xsd\r\n\r\nhttp:\/\/www.springframework.org\/schema\/context\r\n\r\nhttp:\/\/www.springframework.org\/schema\/context\/spring-context-3.0.xsd\r\n\r\nhttp:\/\/www.springframework.org\/schema\/lang\r\n\r\nhttp:\/\/www.springframework.org\/schema\/lang\/spring-lang-3.0.xsd'&gt;\r\n\r\n\t&lt;context:component-scan base-package='com.onlinetechvision.spring.srv'\/&gt;\r\n\r\n\t&lt;lang:groovy id='groovyEmployeeCacheService' script-source='classpath:com\/onlinetechvision\/groovy\/srv\/GroovyEmployeeCacheService.groovy'\/&gt;\r\n\r\n&lt;\/beans&gt;<\/pre>\n<h2>STEP 15 : DOWNLOAD<\/h2>\n<p><strong><a title=\"https:\/\/github.com\/erenavsarogullari\/OTV_Spring_Groovy\" href=\"https:\/\/github.com\/erenavsarogullari\/OTV_Spring_Groovy\" target=\"_blank\">https:\/\/github.com\/erenavsarogullari\/OTV_Spring_Groovy<\/a><\/strong><\/p>\n<h4>RESOURCES : <\/h4>\n<p><strong><a title=\"Groovy User Guide\" href=\"http:\/\/groovy.codehaus.org\/User+Guide\" target=\"_blank\">Groovy User Guide<\/a><\/strong><br \/>\n<strong><a title=\"Spring Dynamic Language Support\" href=\"http:\/\/static.springsource.org\/spring\/docs\/3.0.x\/spring-framework-reference\/html\/dynamic-language.html\" target=\"_blank\">Spring Dynamic Language Support<\/a><\/strong><br \/>\n&nbsp;<\/p>\n<p><strong><em>Reference: <\/em><\/strong><a href=\"http:\/\/www.onlinetechvision.com\/?p=721\">Spring Dynamic Language Support with Groovy<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> Eren Avsarogullari at the <a href=\"http:\/\/www.onlinetechvision.com\/\">Online Technology Vision<\/a> blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Groovy is a dynamic and object-oriented programming language running on JVM. It uses a syntax like Java, can be embedded in Java and is compiled to byte-code. Java code can be called from Groovy, and vice versa. Some of Groovy features are Meta and Functional programming, Dynamic typing (with the def keyword), Closures, GroovyBeans, Groovlets, &hellip;<\/p>\n","protected":false},"author":158,"featured_media":240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[30],"class_list":["post-6701","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-groovy","tag-spring"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Spring Dynamic Language Support with Groovy<\/title>\n<meta name=\"description\" content=\"Groovy is a dynamic and object-oriented programming language running on JVM. It uses a syntax like Java, can be embedded in Java and is compiled to\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring Dynamic Language Support with Groovy\" \/>\n<meta property=\"og:description\" content=\"Groovy is a dynamic and object-oriented programming language running on JVM. It uses a syntax like Java, can be embedded in Java and is compiled to\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2013-01-08T20:00:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Eren Avsarogullari\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Eren Avsarogullari\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/spring-dynamic-language-support-with-groovy.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/spring-dynamic-language-support-with-groovy.html\"},\"author\":{\"name\":\"Eren Avsarogullari\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/65e6e57c730ae5ade3adbadd483553bd\"},\"headline\":\"Spring Dynamic Language Support with Groovy\",\"datePublished\":\"2013-01-08T20:00:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/spring-dynamic-language-support-with-groovy.html\"},\"wordCount\":475,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/spring-dynamic-language-support-with-groovy.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"keywords\":[\"Spring\"],\"articleSection\":[\"Groovy\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/spring-dynamic-language-support-with-groovy.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/spring-dynamic-language-support-with-groovy.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/spring-dynamic-language-support-with-groovy.html\",\"name\":\"Spring Dynamic Language Support with Groovy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/spring-dynamic-language-support-with-groovy.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/spring-dynamic-language-support-with-groovy.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"datePublished\":\"2013-01-08T20:00:54+00:00\",\"description\":\"Groovy is a dynamic and object-oriented programming language running on JVM. It uses a syntax like Java, can be embedded in Java and is compiled to\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/spring-dynamic-language-support-with-groovy.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/spring-dynamic-language-support-with-groovy.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/spring-dynamic-language-support-with-groovy.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"spring-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/spring-dynamic-language-support-with-groovy.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JVM Languages\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/jvm-languages\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Groovy\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/jvm-languages\\\/groovy\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Spring Dynamic Language Support with Groovy\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/65e6e57c730ae5ade3adbadd483553bd\",\"name\":\"Eren Avsarogullari\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d90f2a1d9c2144dd49935d6c84d5c3aa0832793a522148f397bda79bd8e04c16?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d90f2a1d9c2144dd49935d6c84d5c3aa0832793a522148f397bda79bd8e04c16?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d90f2a1d9c2144dd49935d6c84d5c3aa0832793a522148f397bda79bd8e04c16?s=96&d=mm&r=g\",\"caption\":\"Eren Avsarogullari\"},\"sameAs\":[\"http:\\\/\\\/www.onlinetechvision.com\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Eren-Avsarogullari\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring Dynamic Language Support with Groovy","description":"Groovy is a dynamic and object-oriented programming language running on JVM. It uses a syntax like Java, can be embedded in Java and is compiled to","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html","og_locale":"en_US","og_type":"article","og_title":"Spring Dynamic Language Support with Groovy","og_description":"Groovy is a dynamic and object-oriented programming language running on JVM. It uses a syntax like Java, can be embedded in Java and is compiled to","og_url":"https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2013-01-08T20:00:54+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","type":"image\/jpeg"}],"author":"Eren Avsarogullari","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Eren Avsarogullari","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html"},"author":{"name":"Eren Avsarogullari","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/65e6e57c730ae5ade3adbadd483553bd"},"headline":"Spring Dynamic Language Support with Groovy","datePublished":"2013-01-08T20:00:54+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html"},"wordCount":475,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","keywords":["Spring"],"articleSection":["Groovy"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html","url":"https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html","name":"Spring Dynamic Language Support with Groovy","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","datePublished":"2013-01-08T20:00:54+00:00","description":"Groovy is a dynamic and object-oriented programming language running on JVM. It uses a syntax like Java, can be embedded in Java and is compiled to","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","width":150,"height":150,"caption":"spring-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/spring-dynamic-language-support-with-groovy.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"JVM Languages","item":"https:\/\/www.javacodegeeks.com\/category\/jvm-languages"},{"@type":"ListItem","position":3,"name":"Groovy","item":"https:\/\/www.javacodegeeks.com\/category\/jvm-languages\/groovy"},{"@type":"ListItem","position":4,"name":"Spring Dynamic Language Support with Groovy"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/65e6e57c730ae5ade3adbadd483553bd","name":"Eren Avsarogullari","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d90f2a1d9c2144dd49935d6c84d5c3aa0832793a522148f397bda79bd8e04c16?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d90f2a1d9c2144dd49935d6c84d5c3aa0832793a522148f397bda79bd8e04c16?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d90f2a1d9c2144dd49935d6c84d5c3aa0832793a522148f397bda79bd8e04c16?s=96&d=mm&r=g","caption":"Eren Avsarogullari"},"sameAs":["http:\/\/www.onlinetechvision.com\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/Eren-Avsarogullari"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/6701","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/158"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=6701"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/6701\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/240"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=6701"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=6701"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=6701"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}