GateWay
2024-11-14 10:58:19 1 举报
Spring GateWay基础流程概况
作者其他创作
大纲/内容
SimpleHandlerAdapter
获取Route
初始化Bean
routeLocator.getRoutes()
AbstractHandlerMapping
chain.filter(exchange)
实现
combined.addAll(gatewayFilters)
获取路由配置的拦截
RouteDefinitionRouteLocator
RoutePredicateHandlerMapping
choose(exchange)
GatewayLoadBalancerClientAutoConfiguration
handle
getFilters(routeDefinition)
DefaultGatewayFilterChain(combined).filter(exchange)
spring.factory
getHandlerInternal
添加到全局过滤
执行过滤器链
webHandler.handle(exchange)
组装请求URL
返回解析好的Route
mapping.getHandler(exchange)
getHandler(ServerWebExchange exchange)
拿到路由里全部的过滤
获得最终调用实列
从配置文件获取全部路由
combinePredicates(routeDefinition)
继续执行调用器链
getHandlerInternal(exchange)
基于配置文件拿到全部的路由,并存入上下文
getServer(getLoadBalancer(serviceId))
routeDefinitionLocator.getRouteDefinitions()
FilteringWebHandler
执行调用器链
public Flux<RouteDefinition> getRouteDefinitions() {
exchange.getRequiredAttribute(GATEWAY_ROUTE_ATTR)
WebHandler
this::convertToRoute
filter
lookupRoute(exchange)
route.getFilters()
DispatcherHandler
0 条评论
下一页