properly set the bean name for factory generated state machines

- testing: added test case for dynamic generated id
- docs: update documentation
- fix: Support @WithStateMachine for machines generated using either empty id or dynamically generated id
- Fixes #940
This commit is contained in:
George Vagenas
2021-04-25 13:53:34 +01:00
committed by Janne Valkealahti
parent 048e930a19
commit 043d2a7531
4 changed files with 179 additions and 14 deletions

View File

@@ -48,6 +48,11 @@ include::samples/DocsConfigurationSampleTests4.java[tags=snippetAAAA]
----
====
When using StateMachineFactory to generate state machines the state machine using dynamic provided `id`, bean name will default to `stateMachine` it's not possible to use `@WithStateMachine (id = "some-id")` since `id` is only known at runtime.
In such a cases, use either `@WithStateMachine` or `@WithStateMachine(name = "stateMachine")` and all state machines generated by the factory will be atached to your bean or beans.
You can also use `@WithStateMachine` as a meta-annotation, as shown
in the preceding example. In this case, you could annotate your bean with `WithMyBean`.
The following example shows how to do so: