I was trying to use @WithStateMachine with @StateMachineConfigEnums, and I can't see my functions getting called.
My code is:
@Configuration
@EnableStateMachineFactory
public class StateMachineConfigEnums extends StateMachineConfigurerAdapter<String, String> {
}
@WithStateMachine
public class OrderTransitionBean {
@OnTransition(target = "RECEIVED")
void toState1() {
System.out.println("Manish toState1");
}
There might be a simple answer that it is not supported and @WithStateMachine only work with @EnableStateMachine. Or probably I am missing something.
Though other things are working like below or action defined with transitions:
public class OrderStateMachineListener extends StateMachineListenerAdapter<String, String> {
@Override
public void stateChanged(State<String, String> from, State<String, String> to) {
System.out.println("Order state changed to " + to.getId());
}
}
Yes you're right about this, it's not supported as annotation support only works with registered beans and in this case bean is a state machine factory, not machine itself. As you're first one to request this, I created in issue for it gh-224.