GatewayApplication.java
871 Bytes
package com.dituhui.pea.gateway;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import reactor.core.publisher.Mono;
@EnableDiscoveryClient
@SpringBootApplication
@EnableFeignClients(basePackages = {"com.dituhui.pea.user"})
//@EnableFeignClients
public class GatewayApplication {
@Bean
public KeyResolver pathKeyResolver() {
return exchange -> Mono.just(exchange.getRequest().getPath().value());
}
public static void main(String[] args) {
SpringApplication.run(GatewayApplication.class, args);
}
}