[[statemachine-examples]]
= State Machine Examples

This part of the reference documentation explains the use of state
machines together with sample code and UML state charts. We use a few
shortcuts when representing the relationship between a state chart, Spring Statemachine
configuration, and what an application does with a state machine. For
complete examples, you should study the samples repository.

Samples are built directly from a main source distribution during a
normal build cycle. This chapter includes the following samples:

<<statemachine-examples-turnstile>>

<<statemachine-examples-turnstilereactive>>

<<statemachine-examples-showcase>>

<<statemachine-examples-cdplayer>>

<<statemachine-examples-tasks>>

<<statemachine-examples-washer>>

<<statemachine-examples-persist>>

<<statemachine-examples-zookeeper>>

<<statemachine-examples-web>>

<<statemachine-examples-scope>>

<<statemachine-examples-security>>

<<statemachine-examples-eventservice>>

<<statemachine-examples-deploy>>

<<statemachine-examples-ordershipping>>

<<statemachine-examples-datajpa>>

<<statemachine-examples-datapersist>>

<<statemachine-examples-datajpapersist>>

<<statemachine-examples-datajpamultipersist>>

<<statemachine-examples-monitoring>>

The following listing shows how to build the samples:

====
[source,bash]
----
./gradlew clean build -x test
----
====

Every sample is located in its own directory under
`spring-statemachine-samples`. The samples are based on Spring Boot and
Spring Shell, and you can find the usual Boot fat jars under every sample
project's `build/libs` directory.

NOTE: The filenames for the jars to which we refer in this section are populated during a
build of this document, meaning that, if you build samples from
main, you have files with a `BUILD-SNAPSHOT` postfix.

include::sm-examples-turnstile.adoc[]
include::sm-examples-turnstilereactive.adoc[]
include::sm-examples-showcase.adoc[]
include::sm-examples-cdplayer.adoc[]
include::sm-examples-tasks.adoc[]
include::sm-examples-washer.adoc[]
include::sm-examples-persist.adoc[]
include::sm-examples-zookeeper.adoc[]
include::sm-examples-web.adoc[]
include::sm-examples-scope.adoc[]
include::sm-examples-security.adoc[]
include::sm-examples-eventservice.adoc[]
include::sm-examples-deploy.adoc[]
include::sm-examples-ordershipping.adoc[]
include::sm-examples-datajpa.adoc[]
include::sm-examples-datapersist.adoc[]
include::sm-examples-datajpamultipersist.adoc[]
include::sm-examples-datajpapersist.adoc[]
include::sm-examples-monitoring.adoc[]
