Re: [I] [Question] 插件执行的是按照排序的顺序执行嘛 [shenyu]</span></a></span> </h1> <p class="darkgray font13"> <span class="sender pipe"><a href="/search?l=notifications@shenyu.apache.org&q=from:%22via+GitHub%22" rel="nofollow"><span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">via GitHub</span></span></a></span> <span class="date"><a href="/search?l=notifications@shenyu.apache.org&q=date:20250827" rel="nofollow">Wed, 27 Aug 2025 20:11:37 -0700</a></span> </p> </div> <div itemprop="articleBody" class="msgBody"> <!--X-Body-of-Message--> <pre> yuluo-yx commented on issue #6110: URL: <a rel="nofollow" href="https://github.com/apache/shenyu/issues/6110#issuecomment-3231635355">https://github.com/apache/shenyu/issues/6110#issuecomment-3231635355</a></pre><pre> 不是的,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 </pre> </div> <div class="msgButtons margintopdouble"> <ul class="overflow"> <li class="msgButtonItems"><a class="button buttonleft " accesskey="p" href="msg33619.html">Previous message</a></li> <li class="msgButtonItems textaligncenter"><a class="button" accesskey="c" href="index.html#33646">View by thread</a></li> <li class="msgButtonItems textaligncenter"><a class="button" accesskey="i" href="maillist.html#33646">View by date</a></li> <li class="msgButtonItems textalignright"><a class="button buttonright " accesskey="n" href="msg33620.html">Next message</a></li> </ul> </div> <a name="tslice"></a> <div class="tSliceList margintopdouble"> <ul class="icons monospace"> <li class="icons-email"><span class="subject"><a href="msg33619.html">[I] [Question] <title>插件执行的是按照排序的顺序执行嘛 [shenyu]</a></span> <span class="sender italic">via GitHub</span></li> <li><ul> <li class="icons-email tSliceCur"><span class="subject">Re: [I] [Question] <title>插件执行的是按照排序的顺序执行嘛 [shenyu]</span> <span class="sender italic">via GitHub</span></li> </ul> </ul> </div> <div class="overflow msgActions margintopdouble"> <div class="msgReply" > <h2> Reply via email to </h2> <form method="POST" action="/mailto.php"> <input type="hidden" name="subject" value="Re: [I] [Question] <title>插件执行的是按照排序的顺序执行嘛 [shenyu]"> <input type="hidden" name="msgid" value="I_kwDOCGCHjs7Hni4m-f71bed2c-35ad-49b0-ad56-78b6f40e0758@gitbox.apache.org"> <input type="hidden" name="relpath" value="notifications@shenyu.apache.org/msg33646.html"> <input type="submit" value=" via GitHub "> </form> </div> </div> </div> <div class="aside" role="complementary"> <div class="logo"> <a href="/"><img src="/logo.png" width=247 height=88 alt="The Mail Archive"></a> </div> <form class="overflow" action="/search" method="get"> <input type="hidden" name="l" value="notifications@shenyu.apache.org"> <label class="hidden" for="q">Search the site</label> <input class="submittext" type="text" id="q" name="q" placeholder="Search notifications"> <input class="submitbutton" name="submit" type="image" src="/submit.png" alt="Submit"> </form> <div class="nav margintop" id="nav" role="navigation"> <ul class="icons font16"> <li class="icons-home"><a href="/">The Mail Archive home</a></li> <li class="icons-list"><a href="/notifications@shenyu.apache.org/">notifications - all messages</a></li> <li class="icons-about"><a href="/notifications@shenyu.apache.org/info.html">notifications - about the list</a></li> <li class="icons-expand"><a href="/search?l=notifications@shenyu.apache.org&q=subject:%22Re%5C%3A+%5C%5BI%5C%5D+%5C%5BQuestion%5C%5D+%3Ctitle%3E%E6%8F%92%E4%BB%B6%E6%89%A7%E8%A1%8C%E7%9A%84%E6%98%AF%E6%8C%89%E7%85%A7%E6%8E%92%E5%BA%8F%E7%9A%84%E9%A1%BA%E5%BA%8F%E6%89%A7%E8%A1%8C%E5%98%9B+%5C%5Bshenyu%5C%5D%22&o=newest&f=1" title="e" id="e">Expand</a></li> <li class="icons-prev"><a href="msg33619.html" title="p">Previous message</a></li> <li class="icons-next"><a href="msg33620.html" title="n">Next message</a></li> </ul> </div> <div class="listlogo margintopdouble"> </div> <div class="margintopdouble"> </div> </div> </div> <div class="footer" role="contentinfo"> <ul> <li><a href="/">The Mail Archive home</a></li> <li><a href="/faq.html#newlist">Add your mailing list</a></li> <li><a href="/faq.html">FAQ</a></li> <li><a href="/faq.html#support">Support</a></li> <li><a href="/faq.html#privacy">Privacy</a></li> <li class="darkgray">I_kwDOCGCHjs7Hni4m-f71bed2c-35ad-49b0-ad56-78b6f40e0758@gitbox.apache.org</li> </ul> </div> </body> </html>