springboot 3 + apollo client无法创建本地缓存文件
bugarea/clientstatus/need-feedback
看了一下,原因应该是ClassLoaderUtil中的部分逻辑不再适用于spring boot3
static {
if (loader == null) {
logger.warn("Using system class loader");
loader = ClassLoader.getSystemClassLoader();
}
try {
URL url = loader.getResource("");
if (url != null) {
classPath = url.getPath();
classPath = URLDecoder.decode(classPath, "utf-8");
}
if (Strings.isNullOrEmpty(classPath) || classPath.contains(".jar!")) {
classPath = System.getProperty("user.dir");
}
} catch (Throwable ex) {
classPath = System.getProperty("user.dir");
logger.warn("Failed to locate class path, fallback to user.dir: {}", classPath, ex);
}
}
springboot3中获取到的classPath不再包含.jar! 而是 .jar
关闭于 2026-04-12 5 条评论