yuluo-yx commented on issue #6110: URL: https://github.com/apache/shenyu/issues/6110#issuecomment-3231635355
不是的,plugin 实现里面有一个 order 方法,是按照 order 去实现的。 插件 order ``` @Override public int getOrder() { return PluginEnum.DIVIDE.getCode(); } ``` 排序 ``` @Bean("webHandler") public ShenyuWebHandler shenyuWebHandler(final ObjectProvider<List<ShenyuPlugin>> plugins, final ShenyuConfig config, @Lazy final ShenyuLoaderService shenyuLoaderService) { List<ShenyuPlugin> pluginList = plugins.getIfAvailable(Collections::emptyList); List<ShenyuPlugin> shenyuPlugins = pluginList.stream() .sorted(Comparator.comparingInt(ShenyuPlugin::getOrder)).collect(Collectors.toList()); shenyuPlugins.forEach(shenyuPlugin -> LOG.info("load plugin:[{}] [{}]", shenyuPlugin.named(), shenyuPlugin.getClass().getName())); return new ShenyuWebHandler(shenyuPlugins, shenyuLoaderService, config); } ``` 执行 ``` @Override public Mono<Void> execute(final ServerWebExchange exchange) { return Mono.defer(() -> { if (this.index < plugins.size()) { ShenyuPlugin plugin = plugins.get(this.index++); boolean skip = plugin.skip(exchange); if (skip) { return this.execute(exchange); } try { plugin.before(exchange); return plugin.execute(exchange, this); } finally { plugin.after(exchange); } } return Mono.empty(); }); } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@shenyu.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org