Class GrailsComponentScanner


  • public class GrailsComponentScanner
    extends java.lang.Object
    A Grails classes scanner that searches the classpath from an @GrailsComponentScanner specified packages.
    Since:
    2022.0.0
    • Constructor Summary

      Constructors 
      Constructor Description
      GrailsComponentScanner​(org.springframework.context.ApplicationContext context)
      Create a new GrailsComponentScanner instance.
      GrailsComponentScanner​(org.springframework.context.ApplicationContext context, org.springframework.core.metrics.ApplicationStartup applicationStartup)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider createClassPathScanningCandidateComponentProvider​(org.springframework.context.ApplicationContext context)
      Create a ClassPathScanningCandidateComponentProvider to scan entities based on the specified ApplicationContext.
      java.util.List<java.lang.String> getPackages()  
      java.util.Set<java.lang.Class<?>> scan​(java.lang.Class<? extends java.lang.annotation.Annotation>... annotationTypes)
      Scan for entities with the specified annotations.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GrailsComponentScanner

        public GrailsComponentScanner​(org.springframework.context.ApplicationContext context)
        Create a new GrailsComponentScanner instance.
        Parameters:
        context - the source application context
      • GrailsComponentScanner

        public GrailsComponentScanner​(org.springframework.context.ApplicationContext context,
                                      org.springframework.core.metrics.ApplicationStartup applicationStartup)
    • Method Detail

      • scan

        @SafeVarargs
        public final java.util.Set<java.lang.Class<?>> scan​(java.lang.Class<? extends java.lang.annotation.Annotation>... annotationTypes)
                                                     throws java.lang.ClassNotFoundException
        Scan for entities with the specified annotations.
        Parameters:
        annotationTypes - the annotation types used on the artefacts
        Returns:
        a set of artefact classes
        Throws:
        java.lang.ClassNotFoundException - if an artefact class cannot be loaded
      • createClassPathScanningCandidateComponentProvider

        protected org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider createClassPathScanningCandidateComponentProvider​(org.springframework.context.ApplicationContext context)
        Create a ClassPathScanningCandidateComponentProvider to scan entities based on the specified ApplicationContext.
        Parameters:
        context - the ApplicationContext to use
        Returns:
        a ClassPathScanningCandidateComponentProvider suitable to scan entities
        Since:
        2.4.0
      • getPackages

        public java.util.List<java.lang.String> getPackages()