首页 > 解决方案 > Spring Boot DevTools - RestartClassLoader 问题

问题描述

使用 spring boot 开发工具库时,类加载器会出现一些问题,主要是: 在此处输入图像描述

问题是专用类有两个类加载器。当从 memcache 加载类并将类映射/转换到类对象时,会出现类似的异常

java.lang.ClassCastException: class xxx.api.cache.CachedResponse cannot be cast to class xxx.api.cache.CachedResponse (xxx.api.cache.CachedResponse is in unnamed module of loader 'app'; xxx.api.cache.CachedResponse is in unnamed module of loader org.springframework.boot.devtools.restart.classloader.RestartClassLoader @2f6f8549)

我试图CachedResponse从重新启动或某些方式中排除课程,RestartClassLoader但我没有成功。我用过

restart.exclude.classes=file:/app/build/classes/java/main/

属性,但它排除了类路径中的所有分类。我试图排除特定类CachedResponse但没有结果。我也尝试将 folsom jar 包括在内,RestartClassLoader但没有奏效。

是否有可能将该CachedResponse类排除在外RestartClassLoader

标签: spring-bootspring-boot-devtools

解决方案


推荐阅读