content: package cn.datax.gateway.config;
  
  import cn.datax.gateway.handler.HystrixFallbackHandler;
  import lombok.AllArgsConstructor;
  import lombok.extern.slf4j.Slf4j;
  import org.springframework.context.annotation.Bean;
  import org.springframework.http.MediaType;
  import org.springframework.stereotype.Component;
  import org.springframework.web.reactive.function.server.RequestPredicates;
  import org.springframework.web.reactive.function.server.RouterFunction;
  import org.springframework.web.reactive.function.server.RouterFunctions;
  
  /**
   * 路由配置信息 特殊请求直接在此处理，不进行路由转发
   */
  @Slf4j
  @Component
  @AllArgsConstructor
  public class RouterFunctionConfiguration {
  
      private final HystrixFallbackHandler hystrixFallbackHandler;
  
      @Bean
      public RouterFunction routerFunction() {
          return RouterFunctions.route(
                  RequestPredicates.path("/fallback")
                          .and(RequestPredicates.accept(MediaType.TEXT_PLAIN)), hystrixFallbackHandler);
      }
  }
  