使用spring-boot-devtools 热部署遇到的问题

image

 springboot4.0配置redis缓存时,不指定序列化方式时,使用spring-boot-devtools  会报转换类异常

Thu Dec 18 12:58:14 CST 2025
There was an unexpected error (type=Internal Server Error, status=500).
class org.twocache.twocachedemo.bean.Customer cannot be cast to class org.twocache.twocachedemo.bean.Customer (org.twocache.twocachedemo.bean.Customer is in unnamed module of loader 'app'; org.twocache.twocachedemo.bean.Customer is in unnamed module of loader org.springframework.boot.devtools.restart.classloader.RestartClassLoader @23ffe236)
java.lang.ClassCastException: class org.twocache.twocachedemo.bean.Customer cannot be cast to class org.twocache.twocachedemo.bean.Customer (org.twocache.twocachedemo.bean.Customer is in unnamed module of loade
 
指定为redis序列化后就没有上面的问题了
排查出来是因为默认使用jdk 去序列化就会出现上面的问题

image

指定为上面的序列化方式一样出现这样的问题
 
posted @ 2025-12-18 13:29  2022——new_start  阅读(3)  评论(0)    收藏  举报