Back-End (web)
[Spring] GatewayFilterFactory add Order
햄과함께
2020. 7. 2. 11:22
320x100
kotlin 으로 작성되었습니다.
abstract class AbstractOrderedGatewayFilterFactory private constructor() : AbstractGatewayFilterFactory<Any>() {
private var order: Int = 0
constructor(order: Int) : this() {
this.order = order
}
override fun apply(config: Any?): GatewayFilter {
return OrderedGatewayFilter(GatewayFilter { exchange, chain -> chain.filter(exchange) }, order)
}
}
@Component
class CustomGatewayFilterFactory : AbstractOrderedGatewayFilterFactory(10) {
override fun apply(config: Any?) = GatewayFilter { exchange: ServerWebExchange, chain: GatewayFilterChain ->
// ...
}
}
참고 : https://github.com/spring-cloud/spring-cloud-gateway/issues/1122
320x100