2.8. Variables
Prev | 2. Defining Flows | Next

## 2.8. Variables

A flow may declare one or more instance variables. These variables are allocated when the flow starts. Any `@Autowired` transient references the variable holds are also rewired when the flow resumes.

### var

Use the `var` element to declare a flow variable:

    <var name="searchCriteria" class="com.mycompany.myapp.hotels.search.SearchCriteria"/>

Make sure your variable's class implements `java.io.Serializable`, as the instance state is saved between flow requests.

Prev | Up | Next
2.7. Input/Output Mapping | Home | 2.9. Calling subflows