title: Grails: how to call a service and the service name from a string
body: <p>I want to call services dynamically so the service name will get as a string value, we can list all the services names in the grails project by using the code below.</p>
  
  <pre><code>import org.codehaus.groovy.grails.plugins.metadata.GrailsPlugin
  
  for (type in ['service']) {
  
     for (artifactClass in ctx.grailsApplication."${type}Classes") {
  
        def clazz = artifactClass.clazz
  
        def annotation = clazz.getAnnotation(GrailsPlugin)
        if (annotation) {
           println "$type $clazz.name from plugin '${annotation.name()}'"
        }
        else {
           println "$type $clazz.name from application"
        }
     }
  }
  </code></pre>
  
  <p>Here we will get <code>artifactClass</code> of the service.Is there any option to call the service by using this idea.Please help me.</p>