package cn.meowrain.aioj.backend.gateway.config;

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;

/**
 * 网关配置类
 */
@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties(GatewayPropertiesConfiguration.class)
public class GatewayConfiguration {

	/**
	 * 支持负载均衡的 WebClient Bean，用于服务间调用
	 * 加上 @LoadBalanced 注解后可以使用 lb://service-name 格式的 URI
	 */
	@Bean
	@LoadBalanced
	public WebClient.Builder webClientBuilder() {
		return WebClient.builder();
	}

}
