Skip to content

springboot 3 + apollo client无法创建本地缓存文件 #5592

@ives1106

Description

@ives1106

看了一下,原因应该是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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/clientapollo-clientbugCategorizes issue or PR as related to a bug.status/need-feedbackissue need to feedback

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions