I am trying to implement stateMachine using java spring boot,I am using this to perform change the status, I haven't implemented any logic as of now all i want is that stateMachine should start, but i am getting following error when i hit the patch api.
Error:
Cannot invoke "org.springframework.statemachine.config.StateMachineFactory.getStateMachine(String)" because "this.stateMachineFactory" is null
controller file:
 @PatchMapping(value = "/updateStatus", consumes = MediaType.APPLICATION_JSON_VALUE,produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> updateOrderStatus(@Valid @RequestBody OrderStatusUpdateDTO orderStatusUpdateDTO) throws Exception  {
        return ResponseEntity.ok().body(orderService.updateOrderStatus1(orderStatusUpdateDTO));
}
Service implementation
   private StateMachineFactory  <OrderStates, OrderEvents> stateMachineFactory;
   public StateMachine<OrderStates,OrderEvents> updateOrderStatus1(OrderStatusUpdateDTO orderDto){
    var stateMachine =  stateMachineFactory.getStateMachine(orderDto.getOrderUuid().toString());
    stateMachine.start();
    return stateMachine;
}
SateMachine config class
@Configuration
@EnableStateMachine
public class SimpleStateMachineConfiguration extends 
  StateMachineConfigurerAdapter<OrderStates, OrderEvents> {
@Override
public void configure(StateMachineStateConfigurer<OrderStates, OrderEvents> states) throws Exception {
    states.withStates()
            .initial(OrderStates.NEW)
            .state(OrderStates.SCHEDULED)
            .state(OrderStates.DISPATCHED)
            .end(OrderStates.FULFILLED)
            .end(OrderStates.CANCELLED   );
}
@Override
public void configure(StateMachineTransitionConfigurer<OrderStates,
            OrderEvents> transitions) throws Exception {
    transitions
            .withExternal()
            .source(OrderStates.NEW)
            .target(OrderStates.SCHEDULED)
            .event(OrderEvents.SCHEDULED)
            .guard(ctx -> {
                System.out.println("This PAID handler where we can perform some logging");
                return true;
            })
            .and()
            .withExternal()
            .source(OrderStates.DISPATCHED)
            .target(OrderStates.FULFILLED)
            .event(OrderEvents.FULFILLED)
            .action(ctx -> {
                System.out.println("This SUBMITTED handler where we can perform some logging");
            });
}}
