'Spring Statemachine accepting events in parent state but triggering transitions from child state

In my test application I have a nested statemachine in which the parent state can accept a certain event as an internal transition with a certain action, and a child state can accept the same event as an internal transition but with a different action. My expected behaviour would be that if the current_state is parent state p1 then it should also be handled by state p1.

The observed behaviour is that an event sent to a state machine with current_state = p1 (parent state) it is instead the child state that accepts the event and performs its action.

Has anyone come across this behaviour and have a solution?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source