gpt4 book ai didi

java - Spring 状态机 - 为什么文档使用静态类

转载 作者:行者123 更新时间:2023-12-02 09:30:43 25 4
gpt4 key购买 nike

Spring Statemachine主要示例使用 static 类作为 @Configuration

@Configuration
@EnableStateMachine
static class Config1 extends EnumStateMachineConfigurerAdapter<States, Events> {

还有 bean

@WithStateMachine
static class MyBean {

还使用@Autowired:

static class MyApp {
@Autowired
StateMachine<States, Events> stateMachine;

是否可以忽略旧的/示例文档,或者是否有真正的原因/需要使用静态类?

最佳答案

Is it old/sample documentation that can be ignored or is there a real reason/need to use static classes?

是的。

无需静态 - 查看附录中的最新示例 -> 快速示例 - https://docs.spring.io/spring-statemachine/docs/2.1.3.RELEASE/reference/#quick-example甚至在预发行版 3.0.0M1 中 - https://docs.spring.io/spring-statemachine/docs/3.0.0.M1/reference/#appendices

关于java - Spring 状态机 - 为什么文档使用静态类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58011918/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com