With spring state machine, we have states and events. I could not find any documentation on whether it is possible to attach static data to a state during configuration.
This is achieved with two objects in the state machine - StateContext and ExtendedState.
StateContext is like a current snapshot of the State Machine - it's passed around in various methods and callbacks, including actions and guards.
ExtendedState is basically a map with variables.
You can get the ExtendedState from the StateContext:
context.getExtendedState()
.getVariables().put("mykey", "myvalue");
As it is passed around as part of the context, you can access the ExtendedState in every action, transition, guard etc.
The StateMachine object itself also has a getExtendedState() method.
This is the canonical way to pass static data around in the StateMachine.