List<String> ret = new ArrayList<>(); PathMatchingResourcePatternResolver pathMatchingResourcePatternResolver = new PathMatchingResourcePatternResolver(); CachingMetadataReaderFactory cachingMetadataReaderFactory = new CachingMetadataReaderFactory(); org.springframework.core.io.Resource[] resources = pathMatchingResourcePatternResolver.getResources("classpath*:com/peony/common/entity/po/**/*.class"); ClassLoader loader = ClassLoader.getSystemClassLoader(); for (org.springframework.core.io.Resource resource : resources) { MetadataReader reader = cachingMetadataReaderFactory.getMetadataReader(resource); String className = reader.getClassMetadata().getClassName(); Class aClass = loader.loadClass(className); Object o = aClass.newInstance(); }