Developer

Declaring States as Spring Beans

Developing a custom-state bundle requires that you declare each state as a Spring Framework bean in the beans-context.xml file. A state is any Java class that either directly or indirectly extends the SmappStatePlugin abstract class.

Context

You can configure Spring beans by setting properties, or by creating other beans that support state operations.

Procedure

  1. Edit the beans-context.xml file to add a <bean> element for each state. Define:
    • id – name of the state.
    • class – name of the Java class that implements the state.
    For example:
     <bean id="SampleState" class="com.sap.example.SampleState">       
       <property name="country" value="${sample.country}"/>     
     </bean>
    ...
    
  2. (Optional) Declare state properties, and assign either constant values or references to the values that are defined in the properties-context.xml file.
    The value of the <country> property is a reference to the <sample.country> property defined in properties-context.xml.