你好,关于 Spring 状态机。:) 我有一个场景,我必须将一个对象存储在状态机的扩展状态中,然后稍后再获取它以进行处理。当请求进入 SM 时,我执行以下操作并将对象置于扩展状态。
SIMAccountInfo accountInfo =message.getHeaders().get("accountInfo");
stateMachine.getExtendedState().getVariables().put("acc", accountInfo);
然后我将状态机保存在redis中,稍后当我需要这个对象进行处理时,我得到它如下
SIMAccountInfo simAccountInfo =(SIMAccountInfo) context.getStateMachine().getExtendedState().getVariables().get("acc");
但我得到一个类转换异常
java.lang.ClassCastException:com.ctf.sims.dto.xboss.SIMAccountInfo 无法转换为 com.ctf.sims.dto.xboss.SIMAccountInfo
你能猜到为什么会这样吗?