The groovy classes placed in the src/groovy folder does not have dependency injection by default. However we can can access service classes using servlet context.

package com.example.ExampleClass
 
import org.codehaus.groovy.grails.web.context.ServletContextHolder
import org.codehaus.groovy.grails.web.servlet.GrailsApplicationAttributes
 
class ExampleClass {
    def context = ServletContextHolder.servletContext.getAttribute(GrailsApplicationAttributes.APPLICATION_CONTEXT)
    def exampleService = context.exampleService
}