如何向 Spring 状态机外部配置添加反应防护?

问题描述 投票:0回答:1

我正在使用 spring 状态机版本 3.2.1 进行反应式 java 项目。我创建了一个像这样的反应式守卫:

public ReactiveGuard<BookingState, BookingEvent> bookingIdGuard(){
  return context -> //Function that does some checks and return a Mono<Boolean>
}

然后我尝试将其添加到转换外部配置中(类似于我对 ssm 2.x 所做的那样),但是,我找不到任何方法来执行此操作:

@Override
public void configure(StateMachineTransitionConfigurer<BookingState, BookingEvent> transitions) throws Exception {
transitions
 .withExternal()
 .source(BookingState.FIRST)
 .target(BookingState.SECOND)
 .event(BookingEvent.APPROVE)
 //Cannot find a method to add the reactive guard

如何将反应防护添加到配置中?

java spring spring-boot project-reactor spring-statemachine
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.