当组件扫描OsgiBundleResourcePatternResolver中定义的搜索类时,spring-osgi-io中存在bug,这真的很难过。类路径从头开始删除,因此在步骤2中,它搜索包根文件夹,而不是类路径
//消除类路径路径 final String path = OsgiResourceUtils.stripPrefix(locationPattern);
final Collection foundPaths = new LinkedHashSet(); // 1. search the imported packages // find folder path matching final String rootDirPath = determineFolderPattern(path); if (System.getSecurityManager() != null) { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { for (int i = 0; i < importedBundles.length; i++) { final ImportedBundle importedBundle = importedBundles[i]; if (!bundle.equals(importedBundle.getBundle())) { findImportedBundleMatchingResource(importedBundle, rootDirPath, path, foundPaths); } } return null; } }); } else { for (int i = 0; i < importedBundles.length; i++) { final ImportedBundle importedBundle = importedBundles[i]; if (!bundle.equals(importedBundle.getBundle())) { findImportedBundleMatchingResource(importedBundle, rootDirPath, path, foundPaths); } } } // 2. search the target bundle findSyntheticClassPathMatchingResource(bundle, path, foundPaths);