无法自动装配。找不到 'StateMachineFactory<States, Events>' 类型的 beans

Could not autowire. No beans of 'StateMachineFactory<States, Events>' type found

@Configuration
@EnableStateMachineFactory
public class StateMachineConfig extends EnumStateMachineConfigurerAdapter
    <States, Events> {
    // configuring...
}

public enum Events {
    CONFIRM_RESET,
    CANCEL_RESET
    // other events
}

public enum States {
    INITIAL,
    STARTING_ORDER
    // other states
}

@Service
@Slf4j
public class OrderService {
    @Autowired
    private StateMachineFactory<States, Events> stateMachineFactory;

    // Could not autowire. No beans of 'StateMachineFactory<States, Events>' type found.
}

@EnableStateMachineFactory 注释不起作用。无法自动装配。找不到 StateMachineFactory<States, Events>' 类型的 bean。

在使用 @EnableStateMachine 后的同一时间,我可以自动连接 1 个状态机。

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
    <version>2.5.4</version>
</dependency>
<dependency>
    <groupId>org.springframework.statemachine</groupId>
    <artifactId>spring-statemachine-starter</artifactId>
    <version>3.0.1</version>
</dependency>

这解决了我的问题

哦,这是boot starter的一个版本问题,我把我的版本从2.2.1换成2.5.4,问题解决了