{"id":115740,"date":"2026-10-13T09:41:00","date_gmt":"2026-10-13T01:41:00","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/115740.html"},"modified":"2026-10-13T09:41:00","modified_gmt":"2026-10-13T01:41:00","slug":"webflux%e5%ae%9e%e8%b7%b5%e4%b8%8e%e9%80%89%e5%9e%8b%e5%af%b9%e6%af%94%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/115740.html","title":{"rendered":"WebFlux\u5b9e\u8df5\u4e0e\u9009\u578b\u5bf9\u6bd4\u8be6\u89e3"},"content":{"rendered":"<h2>WebFlux\u5b9e\u8df5\u4e0e\u9009\u578b\u5bf9\u6bd4\u8be6\u89e3<\/h2>\n<p>\u5b9a\u4f4d&#xff1a;\u7b2c 07 \u7bc7&#xff0c;\u8bb2\u900f\u5168\u94fe\u8def\u54cd\u5e94\u5f0f\u7684\u5b9e\u8df5\u8981\u6c42\u3001WebClient\u3001\u54cd\u5e94\u5f0f\u6570\u636e\u8bbf\u95ee&#xff0c;\u4ee5\u53ca MVC \u4e0e WebFlux \u7684\u9009\u578b\u51b3\u7b56 \u9002\u7528\u7248\u672c&#xff1a;Spring Framework 6.x&#xff08;JDK 17&#043;&#xff09;<\/p>\n<hr \/>\n<h3>\u76ee\u5f55<\/h3>\n<ul>\n<li>\u4e00\u3001\u5168\u94fe\u8def\u54cd\u5e94\u5f0f<\/li>\n<li>\u4e8c\u3001WebClient<\/li>\n<li>\u4e09\u3001\u54cd\u5e94\u5f0f\u6570\u636e\u8bbf\u95ee<\/li>\n<li>\u56db\u3001MVC vs WebFlux \u9009\u578b<\/li>\n<li>\u4e94\u3001\u603b\u7ed3<\/li>\n<li>\u516d\u3001\u5e38\u89c1\u9ad8\u9891\u9762\u8bd5\u9898<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e00\u3001\u5168\u94fe\u8def\u54cd\u5e94\u5f0f<\/h3>\n<h4>1.1 \u6536\u76ca\u7684\u524d\u63d0&#xff1a;\u7aef\u5230\u7aef\u975e\u963b\u585e<\/h4>\n<p>WebFlux \u7684\u6536\u76ca\u5efa\u7acb\u5728\u6574\u6761\u8c03\u7528\u94fe\u90fd\u975e\u963b\u585e\u4e4b\u4e0a&#xff1a;<\/p>\n<p>\u8bf7\u6c42 \u2192 WebFlux \u2192 WebClient&#xff08;\u8c03\u4e0b\u6e38&#xff09;\u2192 \u54cd\u5e94\u5f0f\u9a71\u52a8&#xff08;DB\/\u7f13\u5b58&#xff09;\u2192 \u8fd4\u56de<br \/>\n        \u975e\u963b\u585e        \u975e\u963b\u585e                 \u975e\u963b\u585e<\/p>\n<p>\u4efb\u4e00\u73af\u8282\u963b\u585e&#xff08;\u5982\u540c\u6b65 JDBC\u3001\u963b\u585e\u7684 HTTP \u5ba2\u6237\u7aef&#xff09;&#xff0c;EventLoop \u5c31\u88ab\u5360\u4f4f&#xff0c;\u6536\u76ca\u5f52\u96f6\u751a\u81f3\u66f4\u5dee\u2014\u2014\u8fd9\u662f&#034;\u7528\u4e86 WebFlux \u5374\u6ca1\u53d8\u5feb&#034;\u7684\u6700\u5e38\u89c1\u539f\u56e0\u3002<\/p>\n<h4>1.2 \u963b\u585e\u73af\u8282\u7684\u4e24\u79cd\u5904\u7406<\/h4>\n<table>\n<tr>\u65b9\u5f0f\u505a\u6cd5<\/tr>\n<tbody>\n<tr>\n<td>\u6362\u54cd\u5e94\u5f0f\u5b9e\u73b0<\/td>\n<td>R2DBC\u3001\u54cd\u5e94\u5f0f Mongo\/Redis\u3001WebClient&#xff08;\u9996\u9009&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u9694\u79bb\u5230\u5f39\u6027\u8c03\u5ea6\u5668<\/td>\n<td>\u65e0\u6cd5\u66ff\u6362\u65f6&#xff0c;subscribeOn(Schedulers.boundedElastic()) \u628a\u963b\u585e\u6bb5\u632a\u51fa EventLoop<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7b2c\u4e8c\u79cd\u662f\u59a5\u534f&#xff1a;\u963b\u585e\u4ecd\u5360\u7ebf\u7a0b&#xff0c;\u53ea\u662f\u4e0d\u5360\u5b9d\u8d35\u7684 EventLoop\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001WebClient<\/h3>\n<h4>2.1 \u5b9a\u4f4d<\/h4>\n<p>\u54cd\u5e94\u5f0f\u975e\u963b\u585e HTTP \u5ba2\u6237\u7aef&#xff0c;\u66ff\u4ee3 RestTemplate&#xff08;\u540e\u8005\u5df2\u8fdb\u5165\u7ef4\u62a4\u6a21\u5f0f&#xff0c;\u65b0\u9879\u76ee\u7528 WebClient&#xff09;\u3002<\/p>\n<h4>2.2 \u7528\u6cd5<\/h4>\n<p><span class=\"token class-name\">WebClient<\/span> client <span class=\"token operator\">&#061;<\/span> <span class=\"token class-name\">WebClient<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">create<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token class-name\">Mono<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">User<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> user <span class=\"token operator\">&#061;<\/span> client<span class=\"token punctuation\">.<\/span><span class=\"token function\">get<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token punctuation\">.<\/span><span class=\"token function\">uri<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\/users\/{id}&#034;<\/span><span class=\"token punctuation\">,<\/span> id<span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token punctuation\">.<\/span><span class=\"token function\">accept<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">MediaType<\/span><span class=\"token punctuation\">.<\/span><span class=\"token constant\">APPLICATION_JSON<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token punctuation\">.<\/span><span class=\"token function\">retrieve<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token punctuation\">.<\/span><span class=\"token function\">bodyToMono<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">User<\/span><span class=\"token punctuation\">.<\/span><span class=\"token keyword\">class<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>          <span class=\"token comment\">\/\/ \u8fd4\u56de Mono&#xff0c;\u60f0\u6027<\/span><\/p>\n<p><span class=\"token class-name\">Flux<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">Order<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> orders <span class=\"token operator\">&#061;<\/span> client<span class=\"token punctuation\">.<\/span><span class=\"token function\">get<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token punctuation\">.<\/span><span class=\"token function\">uri<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\/orders&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token punctuation\">.<\/span><span class=\"token function\">retrieve<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token punctuation\">.<\/span><span class=\"token function\">bodyToFlux<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Order<\/span><span class=\"token punctuation\">.<\/span><span class=\"token keyword\">class<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u8981\u70b9&#xff1a;\u4e0e Reactor \u4e00\u81f4&#xff0c;\u8c03\u7528\u94fe\u5728 subscribe \u524d\u4e0d\u53d1\u8d77\u8bf7\u6c42&#xff1b;WebFlux \u4e2d\u76f4\u63a5\u8fd4\u56de Mono\/Flux \u7ed9\u6846\u67b6\u3002<\/p>\n<h4>2.3 \u9519\u8bef\u4e0e\u914d\u7f6e<\/h4>\n<p>.retrieve().onStatus(&#8230;)&#xff1a;\u6309\u72b6\u6001\u7801\u8f6c\u5f02\u5e38<br \/>\n.exchangeToMono(&#8230;)&#xff1a;\u62ff\u5230\u5b8c\u6574\u54cd\u5e94\u81ea\u884c\u5904\u7406<br \/>\n\u6784\u5efa\u65f6\u914d\u7f6e&#xff1a;baseUrl\u3001\u8d85\u65f6&#xff08;\u8fde\u63a5\/\u54cd\u5e94&#xff09;\u3001\u8fde\u63a5\u6c60\u3001\u7f16\u89e3\u7801\u5668<\/p>\n<p>\u8d85\u65f6\u5fc5\u914d\u2014\u2014\u54cd\u5e94\u5f0f\u5ba2\u6237\u7aef\u4e0d\u914d\u8d85\u65f6\u540c\u6837\u4f1a\u65e0\u9650\u7b49\u5f85&#xff08;01 \u7bc7\u7eaa\u5f8b\u5728\u54cd\u5e94\u5f0f\u4e0b\u4f9d\u7136\u6210\u7acb&#xff09;\u3002<\/p>\n<hr \/>\n<h3>\u4e09\u3001\u54cd\u5e94\u5f0f\u6570\u636e\u8bbf\u95ee<\/h3>\n<h4>3.1 \u9a71\u52a8\u9009\u62e9<\/h4>\n<table>\n<tr>\u5b58\u50a8\u54cd\u5e94\u5f0f\u65b9\u6848<\/tr>\n<tbody>\n<tr>\n<td>\u5173\u7cfb\u5e93<\/td>\n<td>R2DBC&#xff08;Reactive Relational DB Connectivity&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>MongoDB<\/td>\n<td>Spring Data Reactive Mongo<\/td>\n<\/tr>\n<tr>\n<td>Redis<\/td>\n<td>ReactiveRedisTemplate<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4f20\u7edf JDBC \u662f\u963b\u585e\u5f0f\u2014\u2014\u5728 WebFlux \u91cc\u76f4\u63a5\u7528\u5b83\u4f1a\u963b\u585e EventLoop&#xff0c;\u5fc5\u987b\u6362 R2DBC \u6216\u9694\u79bb\u5230\u5f39\u6027\u8c03\u5ea6\u5668\u3002<\/p>\n<h4>3.2 \u4e0e Spring Data \u7684\u6574\u5408<\/h4>\n<p>Spring Data \u63d0\u4f9b\u54cd\u5e94\u5f0f\u4ed3\u5e93\u63a5\u53e3&#xff1a;<\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">interface<\/span> <span class=\"token class-name\">UserRepo<\/span> <span class=\"token keyword\">extends<\/span> <span class=\"token class-name\">ReactiveCrudRepository<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">User<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">String<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token comment\">\/\/ \u65b9\u6cd5\u8fd4\u56de Mono&lt;User&gt; \/ Flux&lt;User&gt;<\/span><\/p>\n<h4>3.3 \u54cd\u5e94\u5f0f\u4e8b\u52a1<\/h4>\n<p>\u54cd\u5e94\u5f0f\u94fe\u8def\u4e0d\u80fd\u4f9d\u8d56 ThreadLocal \u4f20\u9012\u4e8b\u52a1\u8fde\u63a5&#xff08;\u7ebf\u7a0b\u4f1a\u5207\u6362&#xff09;<br \/>\n\u2192 \u7528 ReactiveTransactionManager &#043; &#064;Transactional&#xff08;\u54cd\u5e94\u5f0f\u652f\u6301&#xff09;<br \/>\n\u2192 \u4e8b\u52a1\u4e0a\u4e0b\u6587\u901a\u8fc7 Reactor Context \u4f20\u64ad<\/p>\n<p>\u8fd9\u662f\u54cd\u5e94\u5f0f\u4e0e\u547d\u4ee4\u5f0f\u4e8b\u52a1\u6a21\u578b\u7684\u672c\u8d28\u5dee\u5f02&#xff1a;\u8fde\u63a5\/\u4f1a\u8bdd\u4e0d\u518d\u7ed1\u5b9a\u7ebf\u7a0b&#xff0c;\u800c\u968f\u8ba2\u9605\u4e0a\u4e0b\u6587\u6d41\u52a8\u3002<\/p>\n<hr \/>\n<h3>\u56db\u3001MVC vs WebFlux \u9009\u578b<\/h3>\n<h4>4.1 \u51b3\u7b56\u7ef4\u5ea6<\/h4>\n<table>\n<tr>\u7ef4\u5ea6\u503e\u5411 MVC\u503e\u5411 WebFlux<\/tr>\n<tbody>\n<tr>\n<td>\u5e76\u53d1\u5f62\u6001<\/td>\n<td>\u5e38\u89c4\u5e76\u53d1<\/td>\n<td>\u6d77\u91cf\u8fde\u63a5 &#043; IO \u5bc6\u96c6&#xff08;\u7f51\u5173\u3001\u63a8\u9001\u3001\u805a\u5408&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u751f\u6001<\/td>\n<td>\u4f9d\u8d56\u591a\u4e3a\u963b\u585e&#xff08;\u4f20\u7edf JDBC\/SDK&#xff09;<\/td>\n<td>\u4f9d\u8d56\u652f\u6301\u54cd\u5e94\u5f0f<\/td>\n<\/tr>\n<tr>\n<td>\u56e2\u961f<\/td>\n<td>\u719f\u6089\u540c\u6b65\u6808<\/td>\n<td>\u80fd\u63a5\u53d7\u54cd\u5e94\u5f0f\u5b66\u4e60\u66f2\u7ebf<\/td>\n<\/tr>\n<tr>\n<td>\u8c03\u8bd5\u6210\u672c<\/td>\n<td>\u5806\u6808\u76f4\u89c2<\/td>\n<td>\u5f02\u6b65\u94fe\u8c03\u8bd5\u590d\u6742<\/td>\n<\/tr>\n<tr>\n<td>CPU \u5bc6\u96c6<\/td>\n<td>MVC \u5373\u53ef&#xff08;\u54cd\u5e94\u5f0f\u65e0\u6536\u76ca&#xff09;<\/td>\n<td>\u2014<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>4.2 \u5178\u578b\u9002\u7528\u4e0e\u4e0d\u9002\u7528<\/h4>\n<p>\u9002\u5408 WebFlux&#xff1a;API \u7f51\u5173\u3001\u5b9e\u65f6\u63a8\u9001&#xff08;SSE\/WS&#xff09;\u3001\u6d41\u5f0f\u6570\u636e\u3001\u805a\u5408\u7f16\u6392\u5927\u91cf\u4e0b\u6e38<br \/>\n\u4e0d\u9002\u5408&#xff1a;\u5e38\u89c4 CRUD \u4e1a\u52a1\u7cfb\u7edf\u3001\u4f9d\u8d56\u5927\u91cf\u963b\u585e\u5e93\u3001\u56e2\u961f\u65e0\u54cd\u5e94\u5f0f\u7ecf\u9a8c<\/p>\n<h4>4.3 \u865a\u62df\u7ebf\u7a0b&#xff08;JDK 21&#xff09;\u7684\u65b0\u53d8\u91cf<\/h4>\n<p>\u865a\u62df\u7ebf\u7a0b\u8ba9&#034;\u540c\u6b65\u5199\u6cd5 &#043; \u9ad8\u5e76\u53d1&#034;\u91cd\u65b0\u53ef\u884c&#xff1a;<br \/>\n  \u6bcf\u4e2a\u8bf7\u6c42\u4e00\u4e2a&#xff08;\u5ec9\u4ef7\u7684&#xff09;\u865a\u62df\u7ebf\u7a0b&#xff0c;\u963b\u585e\u4e0d\u518d\u6602\u8d35<br \/>\n  \u2192 \u90e8\u5206&#034;\u4e3a\u5e76\u53d1\u4e0a WebFlux&#034;\u7684\u573a\u666f&#xff0c;\u53ef\u7528 MVC &#043; \u865a\u62df\u7ebf\u7a0b\u66ff\u4ee3<br \/>\n  \u2192 \u4fdd\u7559\u540c\u6b65\u7f16\u7a0b\u6a21\u578b&#xff0c;\u964d\u4f4e\u590d\u6742\u5ea6<\/p>\n<p>\u9009\u578b\u65f6\u8981\u628a\u865a\u62df\u7ebf\u7a0b\u7eb3\u5165\u8003\u91cf&#xff1a;\u82e5 JDK 21&#043; \u53ef\u7528&#xff0c;\u8bb8\u591a\u573a\u666f&#034;\u540c\u6b65 &#043; \u865a\u62df\u7ebf\u7a0b&#034;\u6bd4\u54cd\u5e94\u5f0f\u66f4\u5212\u7b97\u3002<\/p>\n<h4>4.4 \u6e10\u8fdb\u5f0f\u7b56\u7565<\/h4>\n<p>\u4e0d\u5fc5\u975e\u9ed1\u5373\u767d&#xff1a;<br \/>\n  \u2460 MVC \u9879\u76ee\u91cc&#xff0c;\u4e2a\u522b\u63a5\u53e3\u8fd4\u56de CompletableFuture\/Mono&#xff08;Spring MVC \u652f\u6301\u5f02\u6b65\u8fd4\u56de\u503c&#xff09;<br \/>\n  \u2461 \u7528 WebClient \u66ff\u6362 RestTemplate&#xff08;\u5373\u4f7f\u975e WebFlux&#xff09;<br \/>\n  \u2462 \u786e\u6709\u6536\u76ca\u7684\u6a21\u5757\u5355\u72ec\u4e0a WebFlux<\/p>\n<hr \/>\n<h3>\u4e94\u3001\u603b\u7ed3<\/h3>\n<li>\u5168\u94fe\u8def\u54cd\u5e94\u5f0f&#xff1a;\u6536\u76ca\u8981\u6c42\u7aef\u5230\u7aef\u975e\u963b\u585e&#xff0c;\u4efb\u4e00\u963b\u585e\u73af\u8282\u4f7f\u6536\u76ca\u5f52\u96f6&#xff1b;\u963b\u585e\u4f18\u5148\u6362\u54cd\u5e94\u5f0f\u5b9e\u73b0&#xff0c;\u6b21\u9009\u9694\u79bb\u5230 boundedElastic\u3002<\/li>\n<li>WebClient&#xff1a;\u54cd\u5e94\u5f0f\u5ba2\u6237\u7aef\u66ff\u4ee3 RestTemplate&#xff1b;\u60f0\u6027\u6267\u884c\u3001\u9700\u914d\u8d85\u65f6&#xff1b;\u9519\u8bef\u7528 onStatus \u5904\u7406\u3002<\/li>\n<li>\u54cd\u5e94\u5f0f\u6570\u636e\u8bbf\u95ee&#xff1a;R2DBC\/\u54cd\u5e94\u5f0f Mongo\/Redis&#xff1b;\u54cd\u5e94\u5f0f\u4ed3\u5e93\u8fd4\u56de Mono\/Flux&#xff1b;\u4e8b\u52a1\u9760 ReactiveTransactionManager &#043; Context \u4f20\u64ad\u3002<\/li>\n<li>\u9009\u578b&#xff1a;\u6d77\u91cf\u8fde\u63a5 &#043; IO \u5bc6\u96c6 &#043; \u751f\u6001\u652f\u6301\u624d\u9009 WebFlux&#xff1b;\u5e38\u89c4\u4e1a\u52a1\u7528 MVC&#xff1b;JDK 21 \u865a\u62df\u7ebf\u7a0b\u8ba9&#034;\u540c\u6b65\u9ad8\u5e76\u53d1&#034;\u91cd\u65b0\u6210\u4e3a\u7b80\u5355\u9009\u9879&#xff1b;\u53ef\u6e10\u8fdb\u6df7\u7528\u3002<\/li>\n<hr \/>\n<h3>\u516d\u3001\u5e38\u89c1\u9ad8\u9891\u9762\u8bd5\u9898<\/h3>\n<p>1. \u4e3a\u4ec0\u4e48\u8bf4 WebFlux \u9700\u8981&#034;\u5168\u94fe\u8def\u54cd\u5e94\u5f0f&#034;\u624d\u6709\u6536\u76ca&#xff1f;<\/p>\n<p>\u8981\u70b9&#xff1a;WebFlux \u7528\u5c11\u91cf EventLoop \u7ebf\u7a0b\u670d\u52a1\u6240\u6709\u8fde\u63a5&#xff0c;\u524d\u63d0\u662f\u8fd9\u4e9b\u7ebf\u7a0b\u6c38\u4e0d\u88ab\u963b\u585e\u3002\u82e5\u94fe\u8def\u4e2d\u67d0\u73af\u8282\u963b\u585e&#xff08;\u540c\u6b65 JDBC\u3001\u963b\u585e HTTP \u5ba2\u6237\u7aef&#xff09;&#xff0c;EventLoop \u88ab\u5360\u4f4f&#xff0c;\u8be5\u7ebf\u7a0b\u4e0a\u6240\u6709\u8fde\u63a5\u505c\u6446\u2014\u2014\u975e\u963b\u585e\u7684\u6536\u76ca\u88ab\u963b\u585e\u70b9\u5b8c\u5168\u62b5\u6d88&#xff0c;\u751a\u81f3\u56e0\u6a21\u578b\u590d\u6742\u5ea6\u800c\u66f4\u5dee\u3002\u6240\u4ee5\u5fc5\u987b\u7aef\u5230\u7aef\u975e\u963b\u585e&#xff08;\u54cd\u5e94\u5f0f\u9a71\u52a8&#xff09;&#xff0c;\u6216\u628a\u963b\u585e\u73af\u8282\u9694\u79bb\u5230\u5f39\u6027\u8c03\u5ea6\u5668\u3002<\/p>\n<p>2. WebClient \u548c RestTemplate \u7684\u533a\u522b&#xff1f;<\/p>\n<p>\u8981\u70b9&#xff1a;RestTemplate \u662f\u540c\u6b65\u963b\u585e\u5ba2\u6237\u7aef&#xff08;\u5df2\u8fdb\u5165\u7ef4\u62a4\u6a21\u5f0f&#xff0c;\u4e0d\u518d\u52a0\u65b0\u529f\u80fd&#xff09;&#xff1b;WebClient \u662f\u5f02\u6b65\u975e\u963b\u585e\u3001\u57fa\u4e8e Reactor&#xff0c;\u8fd4\u56de Mono\/Flux&#xff0c;\u652f\u6301\u80cc\u538b\u4e0e\u6d41\u5f0f&#xff0c;\u53ef\u5728 WebFlux \u4e0e MVC \u4e2d\u4f7f\u7528\u3002\u65b0\u9879\u76ee\u63a8\u8350 WebClient\u3002\u4f7f\u7528\u5dee\u5f02&#xff1a;WebClient \u8c03\u7528\u94fe\u60f0\u6027&#xff08;\u4e0d\u8ba2\u9605\u4e0d\u53d1\u8d77&#xff09;\u3001\u9700\u81ea\u884c\u5904\u7406\u9519\u8bef&#xff08;onStatus&#xff09;\u3001\u5fc5\u987b\u914d\u7f6e\u8d85\u65f6\u4e0e\u8fde\u63a5\u6c60\u3002<\/p>\n<p>3. \u5728 WebFlux \u91cc\u8bbf\u95ee\u5173\u7cfb\u578b\u6570\u636e\u5e93\u600e\u4e48\u529e&#xff1f;<\/p>\n<p>\u8981\u70b9&#xff1a;\u4f20\u7edf JDBC \u963b\u585e&#xff0c;\u76f4\u63a5\u5728\u54cd\u5e94\u5f0f\u94fe\u4e0a\u7528\u4f1a\u5360\u4f4f EventLoop\u3002\u65b9\u6848&#xff1a;\u2460 \u9996\u9009 R2DBC\u2014\u2014\u5173\u7cfb\u5e93\u7684\u54cd\u5e94\u5f0f\u9a71\u52a8&#xff0c;\u914d\u5408 Spring Data R2DBC&#xff0c;\u4ed3\u5e93\u8fd4\u56de Mono\/Flux&#xff1b;\u2461 \u65e0\u6cd5\u8fc1\u79fb\u65f6&#xff0c;\u628a JDBC \u8c03\u7528\u7528 subscribeOn(Schedulers.boundedElastic()) \u9694\u79bb\u5230\u5f39\u6027\u7ebf\u7a0b\u6c60&#xff08;\u59a5\u534f\u65b9\u6848&#xff0c;\u4ecd\u5360\u7ebf\u7a0b&#xff09;\u3002\u4e8b\u52a1\u7528 ReactiveTransactionManager\u3002<\/p>\n<p>4. \u54cd\u5e94\u5f0f\u4e8b\u52a1\u548c\u4f20\u7edf\u4e8b\u52a1\u6709\u4ec0\u4e48\u4e0d\u540c&#xff1f;<\/p>\n<p>\u8981\u70b9&#xff1a;\u4f20\u7edf&#xff08;\u547d\u4ee4\u5f0f&#xff09;\u4e8b\u52a1\u628a\u8fde\u63a5\u7ed1\u5b9a\u5230\u5f53\u524d\u7ebf\u7a0b&#xff08;ThreadLocal&#xff09;&#xff0c;\u65b9\u6cd5\u8c03\u7528\u94fe\u5929\u7136\u5171\u4eab\u3002\u54cd\u5e94\u5f0f\u94fe\u6267\u884c\u8de8\u7ebf\u7a0b\u5207\u6362&#xff0c;ThreadLocal \u5931\u6548\u2014\u2014\u8fde\u63a5\u4e0d\u80fd\u7ed1\u7ebf\u7a0b\u3002\u89e3\u6cd5&#xff1a;ReactiveTransactionManager &#043; &#064;Transactional \u7684\u54cd\u5e94\u5f0f\u652f\u6301&#xff0c;\u4e8b\u52a1\u4e0a\u4e0b\u6587\u901a\u8fc7 Reactor Context&#xff08;\u968f\u8ba2\u9605\u6d41\u52a8\u800c\u975e\u7ebf\u7a0b&#xff09;\u4f20\u64ad&#xff0c;\u4fdd\u8bc1\u540c\u4e00\u6d41\u4e0a\u7684\u64cd\u4f5c\u5171\u4eab\u4e8b\u52a1\u3002\u8fd9\u662f\u54cd\u5e94\u5f0f\u6a21\u578b&#034;\u7ebf\u7a0b\u4e0d\u6301\u6709\u72b6\u6001&#034;\u7684\u4f53\u73b0\u3002<\/p>\n<p>5. \u4ec0\u4e48\u573a\u666f\u9002\u5408\u7528 WebFlux&#xff1f;<\/p>\n<p>\u8981\u70b9&#xff1a;IO \u5bc6\u96c6 &#043; \u6d77\u91cf\u5e76\u53d1\u8fde\u63a5\u7684\u573a\u666f\u6536\u76ca\u6700\u5927&#xff1a;API \u7f51\u5173&#xff08;\u5927\u91cf\u8f6c\u53d1\u4e0e\u805a\u5408&#xff09;\u3001\u5b9e\u65f6\u63a8\u9001&#xff08;SSE\/WebSocket \u670d\u52a1&#xff09;\u3001\u6d41\u5f0f\u6570\u636e\u5904\u7406\u3001\u9700\u8981\u7f16\u6392\u5927\u91cf\u4e0b\u6e38\u8c03\u7528\u7684\u805a\u5408\u670d\u52a1\u3002\u4e0d\u9002\u5408&#xff1a;\u5e38\u89c4 CRUD&#xff08;\u590d\u6742\u5ea6\u4e0d\u5212\u7b97&#xff09;\u3001CPU \u5bc6\u96c6&#xff08;\u54cd\u5e94\u5f0f\u65e0\u6536\u76ca&#xff09;\u3001\u4f9d\u8d56\u751f\u6001\u591a\u4e3a\u963b\u585e\u5e93\u3001\u56e2\u961f\u65e0\u54cd\u5e94\u5f0f\u7ecf\u9a8c\u3002\u539f\u5219&#xff1a;\u5e76\u53d1\u74f6\u9888\u771f\u5b9e\u5b58\u5728\u4e14\u751f\u6001\u652f\u6301&#xff0c;\u624d\u9009\u3002<\/p>\n<p>6. JDK 21 \u865a\u62df\u7ebf\u7a0b\u5bf9 MVC vs WebFlux \u9009\u578b\u6709\u4ec0\u4e48\u5f71\u54cd&#xff1f;<\/p>\n<p>\u8981\u70b9&#xff1a;\u865a\u62df\u7ebf\u7a0b\u8ba9&#034;\u6bcf\u4e2a\u8bf7\u6c42\u4e00\u4e2a\u7ebf\u7a0b&#034;\u7684\u540c\u6b65\u6a21\u578b\u91cd\u65b0\u5ec9\u4ef7\u2014\u2014\u963b\u585e\u65f6\u865a\u62df\u7ebf\u7a0b\u88ab\u6302\u8d77\u800c\u975e\u5360\u7528\u5e73\u53f0\u7ebf\u7a0b&#xff0c;\u9ad8\u5e76\u53d1\u4e0d\u518d\u9700\u8981\u6d77\u91cf\u5e73\u53f0\u7ebf\u7a0b\u3002\u4e8e\u662f\u8bb8\u591a&#034;\u4e3a\u5e76\u53d1\u4e0a WebFlux&#034;\u7684\u573a\u666f&#xff0c;\u53ef\u4ee5\u7528 MVC &#043; \u865a\u62df\u7ebf\u7a0b\u66ff\u4ee3&#xff0c;\u4fdd\u7559\u540c\u6b65\u7f16\u7a0b\u6a21\u578b\u4e0e\u7b80\u5355\u8c03\u8bd5&#xff0c;\u590d\u6742\u5ea6\u8fdc\u4f4e\u4e8e\u54cd\u5e94\u5f0f\u3002\u9009\u578b\u65f6&#xff1a;JDK 21&#043; \u53ef\u7528\u4e14\u4f9d\u8d56\u963b\u585e\u4e3a\u4e3b&#xff0c;\u865a\u62df\u7ebf\u7a0b\u5f80\u5f80\u662f\u66f4\u4f18\u89e3&#xff1b;\u54cd\u5e94\u5f0f\u4fdd\u7559\u7ed9\u6d41\u5f0f\/\u80cc\u538b\u7b49\u7279\u6b8a\u9700\u6c42\u3002<\/p>\n<p>7. \u963b\u585e\u4ee3\u7801\u5fc5\u987b\u4fdd\u7559\u65f6&#xff0c;\u5728 WebFlux \u91cc\u600e\u4e48\u5904\u7406&#xff1f;<\/p>\n<p>\u8981\u70b9&#xff1a;\u7528\u8c03\u5ea6\u5668\u9694\u79bb&#xff1a;\u628a\u963b\u585e\u6bb5\u7528 subscribeOn \u6216 publishOn \u5207\u5230 Schedulers.boundedElastic()&#xff08;\u4e13\u4e3a\u963b\u585e\u8bbe\u8ba1\u7684\u5f39\u6027\u7ebf\u7a0b\u6c60&#xff09;&#xff0c;\u8ba9\u963b\u585e\u53d1\u751f\u5728\u72ec\u7acb\u6c60\u800c\u975e EventLoop\u3002\u793a\u4f8b&#xff1a;Mono.fromCallable(blockingCall).subscribeOn(boundedElastic())\u3002\u6ce8\u610f\u8fd9\u662f\u59a5\u534f\u2014\u2014\u963b\u585e\u4ecd\u6d88\u8017\u7ebf\u7a0b\u4e0e\u8d44\u6e90&#xff0c;\u53ea\u662f\u4fdd\u62a4\u4e86 EventLoop&#xff1b;\u80fd\u6362\u54cd\u5e94\u5f0f\u5b9e\u73b0&#xff08;R2DBC\u3001WebClient&#xff09;\u5e94\u4f18\u5148\u6362\u3002<\/p>\n<p>8. WebClient \u5982\u4f55\u5904\u7406\u9519\u8bef\u548c\u8d85\u65f6&#xff1f;<\/p>\n<p>\u8981\u70b9&#xff1a;\u9519\u8bef&#xff1a;.retrieve().onStatus(\u8c13\u8bcd, \u54cd\u5e94\u2192\u5f02\u5e38) \u628a 4xx\/5xx \u8f6c\u4e3a\u81ea\u5b9a\u4e49\u5f02\u5e38\u5728\u94fe\u4e0a\u5904\u7406&#xff1b;\u6216\u7528 .exchangeToMono \u62ff\u5b8c\u6574\u54cd\u5e94\u81ea\u884c\u51b3\u5b9a\u3002\u8d85\u65f6&#xff1a;\u6784\u5efa\u65f6\u901a\u8fc7 HttpClient \u914d\u7f6e\u8fde\u63a5\u8d85\u65f6\u4e0e\u54cd\u5e94\u8d85\u65f6&#xff08;reactor-netty&#xff09;&#xff0c;\u6216\u94fe\u4e0a .timeout(Duration)\u3002\u7eaa\u5f8b&#xff1a;\u4e0d\u914d\u8d85\u65f6\u7684\u5ba2\u6237\u7aef\u4f1a\u65e0\u9650\u7b49\u5f85&#xff0c;\u4e0e\u540c\u6b65\u8c03\u7528\u4e00\u6837\u5fc5\u987b\u8bbe\u8d85\u65f6&#xff08;01 \u7bc7\u7684\u901a\u7528\u7eaa\u5f8b\u5728\u54cd\u5e94\u5f0f\u4e0b\u4e0d\u53d8&#xff09;\u3002<\/p>\n<p>9. \u80fd\u53ea\u7528 WebClient \u4e0d\u4e0a WebFlux \u5417&#xff1f;<\/p>\n<p>\u8981\u70b9&#xff1a;\u53ef\u4ee5\u3002WebClient \u662f\u72ec\u7acb\u7ec4\u4ef6&#xff0c;\u5728 Spring MVC&#xff08;\u540c\u6b65&#xff09;\u9879\u76ee\u91cc\u4e5f\u80fd\u7528&#xff0c;\u9002\u5408\u8c03\u7528\u4e0b\u6e38\u7684\u5f02\u6b65\u7f16\u6392\u3001\u5e76\u884c\u805a\u5408\u591a\u4e2a\u8fdc\u7a0b\u7ed3\u679c&#xff08;\u8fd4\u56de Mono\/Flux \u7ec4\u5408&#xff09;&#xff0c;\u6216\u66ff\u6362 RestTemplate\u3002\u6b64\u65f6 Web \u5165\u53e3\u4ecd\u662f MVC \u7684\u540c\u6b65\u6a21\u578b&#xff0c;\u53ea\u662f\u51fa\u7ad9\u8c03\u7528\u7528\u54cd\u5e94\u5f0f\u5ba2\u6237\u7aef\u3002\u8fd9\u4f53\u73b0\u4e86&#034;\u6309\u9700\u5f15\u5165\u54cd\u5e94\u5f0f\u80fd\u529b&#034;\u7684\u6e10\u8fdb\u7b56\u7565&#xff0c;\u4e0d\u5fc5\u6574\u4f53\u8fc1\u79fb\u3002<\/p>\n<p>10. \u56e2\u961f\u8981\u5f15\u5165 WebFlux&#xff0c;\u6709\u54ea\u4e9b\u98ce\u9669\u548c\u51c6\u5907&#xff1f;<\/p>\n<p>\u8981\u70b9&#xff1a;\u98ce\u9669&#xff1a;\u2460 \u5b66\u4e60\u66f2\u7ebf\u9661&#xff08;\u54cd\u5e94\u5f0f\u601d\u7ef4\u3001\u64cd\u4f5c\u7b26\u3001\u60f0\u6027\u6267\u884c&#xff09;&#xff1b;\u2461 \u8c03\u8bd5\u6392\u969c\u96be&#xff08;\u5f02\u6b65\u5806\u6808\u4e0d\u8fde\u8d2f&#xff09;&#xff1b;\u2462 \u751f\u6001\u7ea6\u675f&#xff08;\u963b\u585e\u4f9d\u8d56\u8981\u6362\u6216\u9694\u79bb&#xff09;&#xff1b;\u2463 \u8fd0\u7ef4\u76d1\u63a7\u65b9\u5f0f\u4e0d\u540c\u3002\u51c6\u5907&#xff1a;\u5148\u5c0f\u8303\u56f4\u8bd5\u70b9&#xff08;\u5982\u4e00\u4e2a\u7f51\u5173\u6216\u805a\u5408\u670d\u52a1&#xff09;\u9a8c\u8bc1\u6536\u76ca&#xff1b;\u7edf\u4e00\u963b\u585e\u5904\u7406\u89c4\u8303&#xff08;\u6362\u54cd\u5e94\u5f0f\u9a71\u52a8\u6216\u9694\u79bb\u8c03\u5ea6\u5668&#xff09;&#xff1b;\u5efa\u7acb\u54cd\u5e94\u5f0f\u6d4b\u8bd5&#xff08;StepVerifier&#xff09;\u4e0e\u89c2\u6d4b&#xff08;\u4e0a\u4e0b\u6587\u4f20\u64ad\u65e5\u5fd7&#xff09;&#xff1b;\u8bc4\u4f30\u865a\u62df\u7ebf\u7a0b\u662f\u5426\u662f\u66f4\u7b80\u5355\u7684\u66ff\u4ee3\u3002\u907f\u514d\u5168\u91cf\u76f2\u76ee\u8fc1\u79fb\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261013014058-6acd8c2ab12d3.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>WebFlux\u5b9e\u8df5\u4e0e\u9009\u578b\u5bf9\u6bd4\u8be6\u89e3 \u5b9a\u4f4d&#xff1a;\u7b2c 07 \u7bc7&#xff0c;\u8bb2\u900f\u5168\u94fe\u8def\u54cd\u5e94\u5f0f\u7684\u5b9e\u8df5\u8981\u6c42\u3001WebClient\u3001\u54cd\u5e94\u5f0f\u6570\u636e\u8bbf\u95ee&#xff0c;\u4ee5\u53ca MVC \u4e0e WebFlux \u7684\u9009\u578b\u51b3\u7b56 \u9002\u7528\u7248\u672c&#xff1a;Spring Framework 6.x&#xff08;JDK 17&#xff09; \u76ee\u5f55<br \/>\n\u4e00\u3001\u5168\u94fe\u8def\u54cd\u5e94\u5f0f\u4e8c\u3001WebClient\u4e09\u3001\u54cd\u5e94\u5f0f\u6570\u636e\u8bbf\u95ee\u56db\u3001MVC vs WebFlux \u9009\u578b\u4e94\u3001\u603b\u7ed3\u516d\u3001\u5e38\u89c1\u9ad8\u9891\u9762\u8bd5\u9898 \u4e00\u3001\u5168\u94fe\u8def\u54cd\u5e94\u5f0f<br \/>\n1.1 \u6536\u76ca\u7684<\/p>\n","protected":false},"author":2,"featured_media":115739,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1423,292],"topic":[],"class_list":["post-115740","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-mvc","tag-292"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>WebFlux\u5b9e\u8df5\u4e0e\u9009\u578b\u5bf9\u6bd4\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/115740.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WebFlux\u5b9e\u8df5\u4e0e\u9009\u578b\u5bf9\u6bd4\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"WebFlux\u5b9e\u8df5\u4e0e\u9009\u578b\u5bf9\u6bd4\u8be6\u89e3 \u5b9a\u4f4d&#xff1a;\u7b2c 07 \u7bc7&#xff0c;\u8bb2\u900f\u5168\u94fe\u8def\u54cd\u5e94\u5f0f\u7684\u5b9e\u8df5\u8981\u6c42\u3001WebClient\u3001\u54cd\u5e94\u5f0f\u6570\u636e\u8bbf\u95ee&#xff0c;\u4ee5\u53ca MVC \u4e0e WebFlux \u7684\u9009\u578b\u51b3\u7b56 \u9002\u7528\u7248\u672c&#xff1a;Spring Framework 6.x&#xff08;JDK 17&#xff09; \u76ee\u5f55 \u4e00\u3001\u5168\u94fe\u8def\u54cd\u5e94\u5f0f\u4e8c\u3001WebClient\u4e09\u3001\u54cd\u5e94\u5f0f\u6570\u636e\u8bbf\u95ee\u56db\u3001MVC vs WebFlux \u9009\u578b\u4e94\u3001\u603b\u7ed3\u516d\u3001\u5e38\u89c1\u9ad8\u9891\u9762\u8bd5\u9898 \u4e00\u3001\u5168\u94fe\u8def\u54cd\u5e94\u5f0f 1.1 \u6536\u76ca\u7684\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/115740.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-13T01:41:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261013014058-6acd8c2ab12d3.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115740.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/115740.html\",\"name\":\"WebFlux\u5b9e\u8df5\u4e0e\u9009\u578b\u5bf9\u6bd4\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-13T01:41:00+00:00\",\"dateModified\":\"2026-10-13T01:41:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/115740.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/115740.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115740.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WebFlux\u5b9e\u8df5\u4e0e\u9009\u578b\u5bf9\u6bd4\u8be6\u89e3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"WebFlux\u5b9e\u8df5\u4e0e\u9009\u578b\u5bf9\u6bd4\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/115740.html","og_locale":"zh_CN","og_type":"article","og_title":"WebFlux\u5b9e\u8df5\u4e0e\u9009\u578b\u5bf9\u6bd4\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"WebFlux\u5b9e\u8df5\u4e0e\u9009\u578b\u5bf9\u6bd4\u8be6\u89e3 \u5b9a\u4f4d&#xff1a;\u7b2c 07 \u7bc7&#xff0c;\u8bb2\u900f\u5168\u94fe\u8def\u54cd\u5e94\u5f0f\u7684\u5b9e\u8df5\u8981\u6c42\u3001WebClient\u3001\u54cd\u5e94\u5f0f\u6570\u636e\u8bbf\u95ee&#xff0c;\u4ee5\u53ca MVC \u4e0e WebFlux \u7684\u9009\u578b\u51b3\u7b56 \u9002\u7528\u7248\u672c&#xff1a;Spring Framework 6.x&#xff08;JDK 17&#xff09; \u76ee\u5f55 \u4e00\u3001\u5168\u94fe\u8def\u54cd\u5e94\u5f0f\u4e8c\u3001WebClient\u4e09\u3001\u54cd\u5e94\u5f0f\u6570\u636e\u8bbf\u95ee\u56db\u3001MVC vs WebFlux \u9009\u578b\u4e94\u3001\u603b\u7ed3\u516d\u3001\u5e38\u89c1\u9ad8\u9891\u9762\u8bd5\u9898 \u4e00\u3001\u5168\u94fe\u8def\u54cd\u5e94\u5f0f 1.1 \u6536\u76ca\u7684","og_url":"https:\/\/www.wsisp.com\/helps\/115740.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-13T01:41:00+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261013014058-6acd8c2ab12d3.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/115740.html","url":"https:\/\/www.wsisp.com\/helps\/115740.html","name":"WebFlux\u5b9e\u8df5\u4e0e\u9009\u578b\u5bf9\u6bd4\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-13T01:41:00+00:00","dateModified":"2026-10-13T01:41:00+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/115740.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/115740.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/115740.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"WebFlux\u5b9e\u8df5\u4e0e\u9009\u578b\u5bf9\u6bd4\u8be6\u89e3"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115740","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=115740"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115740\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/115739"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=115740"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=115740"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=115740"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=115740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}