package com.red.circle.gateway.config;

import com.red.circle.gateway.filter.factory.ForwardRouteGatewayFilterFactory;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.client.WebClient;

/**
 * 网关配置.
 *
 * @author pengliang on 2023/4/18
 */
@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties(GatewayProperties.class)
public class GatewayConfiguration {


  @Bean
  @LoadBalanced
  public WebClient.Builder webClient() {
    return WebClient.builder();
  }

  @Bean
  public ForwardRouteGatewayFilterFactory forwardRouteGatewayFilterFactory() {
    return new ForwardRouteGatewayFilterFactory();
  }

}
