@Configuration
public class RateLimiterConfiguration
extends java.lang.Object
构造器和说明 |
---|
RateLimiterConfiguration() |
限定符和类型 | 方法和说明 |
---|---|
org.springframework.cloud.gateway.filter.ratelimit.KeyResolver |
apiKeyResolver()
接口限流 (获取请求地址的uri作为限流key)
|
org.springframework.cloud.gateway.filter.ratelimit.KeyResolver |
ipKeyResolver()
IP限流 (通过exchange对象可以获取到请求信息,这边用了HostName)
|
org.springframework.cloud.gateway.filter.ratelimit.KeyResolver |
userKeyResolver()
用户限流 (通过exchange对象可以获取到请求信息,获取当前请求的用户 TOKEN)
|
@Bean @Primary public org.springframework.cloud.gateway.filter.ratelimit.KeyResolver ipKeyResolver()
@Bean public org.springframework.cloud.gateway.filter.ratelimit.KeyResolver userKeyResolver()
@Bean public org.springframework.cloud.gateway.filter.ratelimit.KeyResolver apiKeyResolver()