复制代码
1
2
3
4
5
6
7
8
9
10
11@Configuration @EnableStateMachine public class Config extends EnumStateMachineConfigurerAdapter<States, Events> { } @Configuration @EnableStateMachineFactory public class Config extends EnumStateMachineConfigurerAdapter<States, Events> { }
在StateMachineConfigurer类的实现上,既可以使用@EnableStateMachine,又可以使用@EnableStateMachineFactory的原因是,构建一个StateMachine对象和构建一个StateMachineFactory对象需要的信息是一样的,具体可以查看StateMachineConfigurer接口;
StateMachineConfigurer用于提供这些信息,至于创建StateMachine对象还是创建StateMachineFactory,然后用户再选择和时的世纪创建StateMachine对象,用户自己来选择;
最后
以上就是曾经小蚂蚁最近收集整理的关于@EnableStateMachine和@EnableStateMachineFactory的全部内容,更多相关@EnableStateMachine和@EnableStateMachineFactory内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复