public void scanConfigurableBeans ( String ... basePackages ) throws BeanRuleException { if ( basePackages == null || basePackages . length == 0 ) { return ; } log . info ( "Auto component scanning on packages [" + StringUtils . joinCommaDelimitedList ( basePackages ) + "]" ) ; for ( String basePackage : basePackages ) { BeanClassScanner scanner = new BeanClassScanner ( classLoader ) ; List < BeanRule > beanRules = new ArrayList <> ( ) ; scanner . scan ( basePackage + ".**" , ( resourceName , targetClass ) -> { if ( targetClass . isAnnotationPresent ( Component . class ) ) { BeanRule beanRule = new BeanRule ( ) ; beanRule . setBeanClass ( targetClass ) ; beanRule . setScopeType ( ScopeType . SINGLETON ) ; beanRules . add ( beanRule ) ; } } ) ; for ( BeanRule beanRule : beanRules ) { saveConfigurableBeanRule ( beanRule ) ; } } }
Scans for annotated components .