You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just encounter a problem when using spring state machine @WithStateMachine.
@WithStateMachine just work when I use it on inner class which defined in the class annotated by @EnableStateMachine, but when I define class in other place it seems not work.
Here is my code:
`@Configuration @EnableStateMachine public class StateMachineConfig extends EnumStateMachineConfigurerAdapter { private Logger logger = LoggerFactory.getLogger(getClass());
@OverRide
public void configure(StateMachineStateConfigurer<States, Events> states)
throws Exception {
states
.withStates()
.initial(States.UNPAID)
.states(EnumSet.allOf(States.class));
}
I just encounter a problem when using spring state machine @WithStateMachine.
@WithStateMachine just work when I use it on inner class which defined in the class annotated by @EnableStateMachine, but when I define class in other place it seems not work.
Here is my code:
`@Configuration @EnableStateMachine public class StateMachineConfig extends EnumStateMachineConfigurerAdapter { private Logger logger = LoggerFactory.getLogger(getClass());
@OverRide
public void configure(StateMachineStateConfigurer<States, Events> states)
throws Exception {
states
.withStates()
.initial(States.UNPAID)
.states(EnumSet.allOf(States.class));
}
@OverRide
public void configure(StateMachineTransitionConfigurer<States, Events> transitions)
throws Exception {
transitions
.withExternal()
.source(States.UNPAID).target(States.WAITING_FOR_RECEIVE)
.event(Events.PAY)
.and()
.withExternal()
.source(States.WAITING_FOR_RECEIVE).target(States.DONE)
.event(Events.RECEIVE);
}
@OverRide
public void configure(StateMachineConfigurationConfigurer<States, Events> config)
throws Exception {
config
.withConfiguration()
.autoStartup(true);
//.listener(listener());
}
//
//@bean
//public StateMachineListener<States, Events> listener() {
// return new StateMachineListenerAdapter<States, Events>() {
// @OverRide
// public void transition(Transition<States, Events> transition) {
// if (transition.getTarget().getId() == States.UNPAID) {
// logger.info("UNPAID");
// return;
// }
// if (transition.getSource().getId() == States.UNPAID
// && transition.getTarget().getId() == States.WAITING_FOR_RECEIVE) {
// logger.info("WAITING_FOR_RECEIVE");
// return;
// }
// if (transition.getSource().getId() == States.WAITING_FOR_RECEIVE
// && transition.getTarget().getId() == States.DONE) {
// logger.info("DONE");
// return;
// }
// }
// };
//}
@WithStateMachine
public class Action {
private Logger logger = LoggerFactory.getLogger(getClass());
}
}`
but when I define Action in another class file, it is not work.
My pom
org.springframework
spring-core
4.3.3.RELEASE
org.springframework
spring-messaging
1.2.3.RELEASE
Originally posted by @TimGuan in #232 (comment)
The text was updated successfully, but these errors were encountered: