Q:

GrailsApplication src/classes

According to Grails API, we can retrieve all domain classes definition through GrailsApplication as such
import org.codehaus.groovy.grails.commons.ApplicationHolder as AH   
 AH.application.domainClasses

I have classes defined under src/groovy and would like to do the same. I tried using the follwing code but in vain 
    import org.codehaus.groovy.grails.commons.ApplicationHolder as AH   
 AH.application.allClasses

According to Grails API, call to getAllClasses should return all classes loaded by Grails class loader 

Class[]  getAllClasses()
            Retrieves all java.lang.Class instances loaded by the Grails class loader

Am i missing something 

A:

Any Java or Groovy code can be placed in the src directory and does not have to integrate with Grails. The Grails class loader only loads Grails specific classes such as pluggins, controllers, and domain classes that your grails application knows about at run-time. In order to find out about classes located in your src directory you will need to know the package name your interested in and then iterate through everything contained in that package.

A:

.
Well the classes under 'src' are not registered with grails classLoader. But you can use the "in context class loader" to get those classes easily using one single line of code (Java Style though)
Class fetchedClass = Class.forName(
    "Class Full Name Here", 
    true, 
    Thread.currentThread().getContextClassLoader()
)

.
.
Thats It .. :) All Done!! Easily.
. 
. 
Example to get the class "com.myPackage.dto.AddressDTO"
We will Do:
EXAMPLE: get class "com.myPackage.dto.AddressDTO"
Class fetchedClass = Class.forName(
        "com.myPackage.dto.AddressDTO", 
        true, 
        Thread.currentThread().getContextClassLoader()
    )

