0
点赞
收藏
分享

微信扫一扫

Spring Cloud Alibaba - 27 Gateway源码解析

文章目录

在这里插入图片描述


How it works

https://docs.spring.io/spring-cloud-gateway/docs/current/reference/html/

在这里插入图片描述
3.x版本


入口

按照boot的套路,找两个地方:

  • 注解 (Gateway没有呢…)
  • pom中的jar包 对应的 spring.factories 中的EnableAutoConfiguration类

那就 先找pom的starter

在这里插入图片描述

然后找这个spring.factories 吧, 如下

在这里插入图片描述

GatewayAutoConfiguration 符合 boot的约定,其实我们可以直接猜测 GatewayAutoConfiguration 。

@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(name = "spring.cloud.gateway.enabled", matchIfMissing = true)
@EnableConfigurationProperties
@AutoConfigureBefore({ HttpHandlerAutoConfiguration.class, WebFluxAutoConfiguration.class })
@AutoConfigureAfter({ GatewayReactiveLoadBalancerClientAutoConfiguration.class,
		GatewayClassPathWarningAutoConfiguration.class })
@ConditionalOnClass(DispatcherHandler.class)
public class GatewayAutoConfiguration {
  .........
}

找个这个地方,肯定是要看@Bean的


源码流程

举报

相关推荐

0 条评论