private static Collection < ? extends URL > doFindPathMatchingFileResources ( final URL rootDirResource , final String subPattern ) { File rootFile = null ; final Set < URL > rets = new LinkedHashSet < URL > ( ) ; try { rootFile = new File ( rootDirResource . toURI ( ) ) ; } catch ( final URISyntaxException e ) { LOGGER . log ( Level . ERROR , "cat not resolve the rootFile" , e ) ; throw new RuntimeException ( "cat not resolve the rootFile" , e ) ; } String fullPattern = StringUtils . replace ( rootFile . getAbsolutePath ( ) , File . separator , "/" ) ; if ( ! subPattern . startsWith ( "/" ) ) { fullPattern += "/" ; } final String filePattern = fullPattern + StringUtils . replace ( subPattern , File . separator , "/" ) ; @ SuppressWarnings ( "unchecked" ) final Collection < File > files = FileUtils . listFiles ( rootFile , new IOFileFilter ( ) { @ Override public boolean accept ( final File dir , final String name ) { return true ; } @ Override public boolean accept ( final File file ) { if ( file . isDirectory ( ) ) { return false ; } if ( AntPathMatcher . match ( filePattern , StringUtils . replace ( file . getAbsolutePath ( ) , File . separator , "/" ) ) ) { return true ; } return false ; } } , TrueFileFilter . INSTANCE ) ; try { for ( File file : files ) { rets . add ( file . toURI ( ) . toURL ( ) ) ; } } catch ( final Exception e ) { LOGGER . log ( Level . ERROR , "convert file to URL error" , e ) ; throw new RuntimeException ( "convert file to URL error" , e ) ; } return rets ; }
scan the system file to get the URLS of the Classes .