2017-02-17 129 views
0

配置代碼春天的statemachine復位狀態不會觸發入口動作

states .withStates() .initial(OrderState.Create) .state(OrderState.Create, startAction) .state(OrderState.Payed, paymentAction) .states(EnumSet.allOf(OrderState.class));

運行代碼

stateMachine .getStateMachineAccessor() .doWithAllRegions(access -> { access.resetStateMachine(new DefaultStateMachineContext<> (OrderState.Payed, null, null, null, null)); }); stateMachine.start();

paymentAction不會觸發時開始, 如何觸發

回答

0

那麼,你的代碼永遠不會進入將運行的狀態PayedpaymentAction。它只進入初始狀態Create。如果在CreatePayed之間存在匿名轉換,則認爲您沒有顯示任何轉換配置,因此只能進入該狀態。