spring-projects / spring-statemachine

Spring Statemachine is a framework for application developers to use state machine concepts with Spring.
1.52k stars 598 forks source link

Potential Bug : Showcase Sample #1095

Closed gpadbidri closed 8 months ago

gpadbidri commented 1 year ago

https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/showcase/src/main/java/demo/showcase/Application.java

Line No 86 should the source be States.S0 as the initial is set to S0 or the workflow wouldnt just kickstart ?

.withExternal() .**source(States.S1).**target(States.S1).event(Events.A) .guard(foo1Guard()) .and()

Meaning why would the source and target be the same ?

jvalkeal commented 8 months ago

Sample section for this in docs has a statechart. It's indeed a valid transition while most of a cases not really useful. It mostly exists because you can do transition between sub/parent states and there's a difference for External versus Local Transitions what comes for actual entry/exit and their possible actions. This all is coming from UML specification.