0
你好再次关于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
你能猜出为什么会发生这种情况吗?