{"id":112435,"date":"2026-10-03T16:16:53","date_gmt":"2026-10-03T08:16:53","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/112435.html"},"modified":"2026-10-03T16:16:53","modified_gmt":"2026-10-03T08:16:53","slug":"spring-ai-%e5%81%9c%e6%ad%a2%e7%94%9f%e6%88%90%e8%ae%be%e8%ae%a1%ef%bc%9a%e4%bb%8e%e8%bf%9b%e7%a8%8b%e5%86%85%e7%8a%b6%e6%80%81%e5%88%b0%e5%88%86%e5%b8%83%e5%bc%8f%e4%bb%bb%e5%8a%a1%e6%8e%a7%e5%88%b6","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/112435.html","title":{"rendered":"Spring AI \u505c\u6b62\u751f\u6210\u8bbe\u8ba1\uff1a\u4ece\u8fdb\u7a0b\u5185\u72b6\u6001\u5230\u5206\u5e03\u5f0f\u4efb\u52a1\u63a7\u5236"},"content":{"rendered":"<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"400\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261003081650-6ac0b9f299533.png\" width=\"711\" \/><\/p>\n<h2>\u4e00\u3001\u505c\u6b62\u751f\u6210\u7684\u63a7\u5236\u8fb9\u754c<\/h2>\n<p>\u6d41\u5f0f\u804a\u5929\u4e2d&#xff0c;\u201c\u505c\u6b62\u751f\u6210\u201d\u770b\u8d77\u6765\u53ea\u662f\u4e00\u4e2a\u6309\u94ae&#xff0c;\u540e\u7aef\u5904\u7406\u7684\u5374\u662f\u4e00\u4e2a\u6301\u7eed\u8fd0\u884c\u7684\u751f\u6210\u4efb\u52a1\u3002\u7528\u6237\u70b9\u51fb\u505c\u6b62\u540e&#xff0c;\u6700\u76f4\u63a5\u7684\u76ee\u6807\u662f\u8ba9\u540e\u7eed\u6a21\u578b\u5185\u5bb9\u4e0d\u518d\u7ee7\u7eed\u53d1\u9001\u5230\u524d\u7aef&#xff0c;\u56e0\u6b64<span style=\"color:#1a439c\">\u5e94\u7528\u9700\u8981\u63a7\u5236\u5f53\u524d Reactive \u6d41\u7684\u751f\u547d\u5468\u671f<\/span>\u3002<\/p>\n<p>\u8fd9\u91cc\u9996\u5148\u8981\u533a\u5206\u4e24\u4e2a\u5c42\u6b21\u3002\u7b2c\u4e00\u5c42\u662f\u5e94\u7528\u4fa7\u505c\u6b62\u8f93\u51fa&#xff0c;\u5373\u540e\u7aef\u7ec8\u6b62\u5f53\u524d Flux&#xff0c;\u8ba9\u540e\u7eed chunk \u4e0d\u518d\u7ee7\u7eed\u5411\u5ba2\u6237\u7aef\u4f20\u9012&#xff1b;\u7b2c\u4e8c\u5c42\u662f\u6a21\u578b Provider \u662f\u5426\u771f\u6b63\u505c\u6b62\u8fdc\u7aef\u63a8\u7406\u3002\u524d\u8005\u53ef\u4ee5\u7531\u5e94\u7528\u63a7\u5236&#xff0c;\u540e\u8005\u8fd8\u53d6\u51b3\u4e8e HTTP \u5ba2\u6237\u7aef\u3001\u6a21\u578b SDK \u548c Provider \u5bf9\u53d6\u6d88\u8bf7\u6c42\u7684\u652f\u6301\u3002<\/p>\n<p>\u56e0\u6b64&#xff0c;\u4e00\u4e2a\u53ef\u9760\u7684\u505c\u6b62\u529f\u80fd\u9996\u5148\u5e94\u8be5\u4fdd\u8bc1\u5e94\u7528\u4fa7\u4efb\u52a1\u80fd\u591f\u88ab\u51c6\u786e\u5b9a\u4f4d\u548c\u53d6\u6d88\u3002<\/p>\n<hr \/>\n<h2>\u4e8c\u3001\u5355\u4e00\u72b6\u6001\u53d8\u91cf\u7684\u9002\u7528\u8303\u56f4<\/h2>\n<p>\u6700\u5c0f Demo \u4e2d&#xff0c;\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u4e00\u4e2a boolean \u8868\u793a\u5f53\u524d\u662f\u5426\u7ee7\u7eed\u751f\u6210&#xff1a;<\/p>\n<p>\/\/ \u6807\u8bb0\u5f53\u524d\u662f\u5426\u7ee7\u7eed\u751f\u6210<br \/>\nboolean generating &#061; true;<\/p>\n<p>\u6a21\u578b\u6301\u7eed\u8f93\u51fa\u65f6\u68c0\u67e5\u8be5\u53d8\u91cf&#xff0c;\u7528\u6237\u70b9\u51fb\u505c\u6b62\u540e\u5c06\u5176\u6539\u6210 false\u3002\u5bf9\u4e8e\u53ea\u6709\u4e00\u4e2a\u7528\u6237\u3001\u4e00\u4e2a\u4efb\u52a1\u7684\u5b9e\u9a8c\u73af\u5883&#xff0c;\u8fd9\u5df2\u7ecf\u80fd\u591f\u5b8c\u6210\u57fa\u672c\u529f\u80fd\u3002<\/p>\n<p>\u95ee\u9898\u5728\u591a\u7528\u6237\u73af\u5883\u4e2d\u7acb\u5373\u51fa\u73b0\u3002<span style=\"color:#be191c\">Web \u670d\u52a1\u53ef\u80fd\u540c\u65f6\u5904\u7406\u591a\u4e2a\u751f\u6210\u8bf7\u6c42&#xff0c;\u5168\u5c40 boolean \u65e0\u6cd5\u533a\u5206\u5f53\u524d\u72b6\u6001\u5c5e\u4e8e\u54ea\u4e00\u4e2a\u7528\u6237\u6216\u54ea\u4e00\u6b21\u4f1a\u8bdd<\/span>\u3002\u7528\u6237 A \u70b9\u51fb Stop \u540e&#xff0c;\u5982\u679c\u76f4\u63a5\u4fee\u6539\u5168\u5c40\u53d8\u91cf&#xff0c;\u7528\u6237 B \u6b63\u5728\u8fdb\u884c\u7684\u751f\u6210\u4efb\u52a1\u4e5f\u53ef\u80fd\u53d7\u5230\u5f71\u54cd\u3002<\/p>\n<p>\u56e0\u6b64&#xff0c;\u505c\u6b62\u72b6\u6001\u5fc5\u987b\u4ece\u201c\u5168\u5c40\u72b6\u6001\u201d\u5347\u7ea7\u4e3a\u201c<span style=\"color:#1c7331\">\u4efb\u52a1\u5173\u8054\u72b6\u6001<\/span>\u201d\u3002<\/p>\n<hr \/>\n<h2>\u4e09\u3001\u4f1a\u8bdd\u7ea7\u72b6\u6001\u4e0e\u5e76\u53d1\u5b89\u5168<\/h2>\n<p>\u6700\u76f4\u63a5\u7684\u6539\u8fdb&#xff0c;\u662f\u628a\u751f\u6210\u72b6\u6001\u4e0e Session ID \u5173\u8054&#xff1a;<\/p>\n<p>\/\/ \u6bcf\u4e2a\u4f1a\u8bdd\u72ec\u7acb\u7ef4\u62a4\u751f\u6210\u72b6\u6001<br \/>\nsessionA \u2192 true<br \/>\nsessionB \u2192 true<br \/>\nsessionC \u2192 true<\/p>\n<p>\u5f00\u59cb\u751f\u6210\u65f6\u5199\u5165\u72b6\u6001&#xff0c;\u505c\u6b62\u65f6\u5220\u9664\u72b6\u6001\u3002\u8bfe\u7a0b\u4e2d\u53ef\u4ee5\u4f7f\u7528 ConcurrentHashMap \u4fdd\u5b58\u8fd9\u7c7b\u6570\u636e&#xff1a;<\/p>\n<p>\/\/ \u7ebf\u7a0b\u5b89\u5168\u7684\u4f1a\u8bdd\u7ea7\u72b6\u6001\u5bb9\u5668<br \/>\nprivate final Map&lt;String, Boolean&gt; generating &#061;<br \/>\n        new ConcurrentHashMap&lt;&gt;();<\/p>\n<p>\u751f\u6210\u5f00\u59cb\u65f6&#xff1a;<\/p>\n<p>\/\/ \u751f\u6210\u5f00\u59cb\u65f6\u6807\u8bb0\u4e3a\u8fd0\u884c\u4e2d<br \/>\ngenerating.put(sessionId, true);<\/p>\n<p>\u7528\u6237\u505c\u6b62\u65f6&#xff1a;<\/p>\n<p>\/\/ \u7528\u6237\u505c\u6b62\u65f6\u79fb\u9664\u72b6\u6001<br \/>\ngenerating.remove(sessionId);<\/p>\n<p>\u8bfb\u53d6\u72b6\u6001\u65f6&#xff1a;<\/p>\n<p>generating.getOrDefault(sessionId, false);<\/p>\n<p>\u8fd9\u91cc\u4f7f\u7528 ConcurrentHashMap \u7684\u539f\u56e0&#xff0c;\u662f Web \u8bf7\u6c42\u5b58\u5728\u5e76\u53d1\u8bfb\u5199\u3002\u666e\u901a HashMap \u4e0d\u9002\u5408\u4f5c\u4e3a\u591a\u4e2a\u7ebf\u7a0b\u5171\u4eab\u4fee\u6539\u7684\u8fd0\u884c\u72b6\u6001\u5bb9\u5668\u3002<\/p>\n<p>\u505c\u6b62\u540e\u76f4\u63a5 remove&#xff0c;\u4e5f\u6bd4\u957f\u671f\u4fdd\u5b58 false \u66f4\u5408\u7406\u3002\u5df2\u7ecf\u7ed3\u675f\u7684\u4efb\u52a1\u4e0d\u518d\u5177\u6709\u4e1a\u52a1\u4ef7\u503c&#xff0c;\u5982\u679c\u6bcf\u4e2a\u5386\u53f2 Session \u90fd\u6c38\u4e45\u4fdd\u7559\u4e00\u4e2a\u72b6\u6001\u503c&#xff0c;\u5bb9\u5668\u4f1a\u6301\u7eed\u589e\u957f\u3002<\/p>\n<hr \/>\n<h2>\u56db\u3001Reactive \u6d41\u7684\u7ec8\u6b62\u4e0e\u8d44\u6e90\u6e05\u7406<\/h2>\n<p>\u6709\u4e86\u4efb\u52a1\u72b6\u6001\u4ee5\u540e&#xff0c;\u5c31\u53ef\u4ee5\u628a\u5b83\u4e0e Reactor Flux \u7ed3\u5408\u3002takeWhile \u4f1a\u5728\u5143\u7d20\u7ee7\u7eed\u5411\u4e0b\u6e38\u4f20\u9012\u4e4b\u524d\u6267\u884c Predicate&#xff0c;\u53ea\u8981\u6761\u4ef6\u6210\u7acb\u5c31\u7ee7\u7eed&#xff0c;\u4e00\u65e6\u6761\u4ef6\u53d8\u4e3a false&#xff0c;\u5f53\u524d\u6d41\u5c31\u505c\u6b62\u7ee7\u7eed\u53d1\u9001\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>return modelFlux<br \/>\n        .takeWhile(chunk -&gt;<br \/>\n                generating.getOrDefault(sessionId, false))<br \/>\n        .doFinally(signal -&gt;<br \/>\n                generating.remove(sessionId));<\/p>\n<p>\u8fd9\u79cd\u7ed3\u6784\u4e2d&#xff0c;\u72b6\u6001\u8d1f\u8d23\u8868\u8fbe\u201c\u4efb\u52a1\u662f\u5426\u4ecd\u7136\u6709\u6548\u201d&#xff0c;takeWhile \u8d1f\u8d23\u6839\u636e\u72b6\u6001\u51b3\u5b9a\u662f\u5426\u7ee7\u7eed\u8f93\u51fa\u3002<\/p>\n<p>\u8d44\u6e90\u6e05\u7406\u540c\u6837\u91cd\u8981\u3002<span style=\"color:#be191c\">\u751f\u6210\u4efb\u52a1\u53ef\u80fd\u901a\u8fc7\u6b63\u5e38\u5b8c\u6210\u3001\u5f02\u5e38\u3001\u7528\u6237\u53d6\u6d88\u7b49\u591a\u79cd\u65b9\u5f0f\u7ed3\u675f\u3002\u5982\u679c\u53ea\u5728\u67d0\u4e00\u79cd\u8def\u5f84\u4e2d remove&#xff0c;\u5c31\u53ef\u80fd\u9057\u7559\u5931\u6548\u72b6\u6001<\/span>\u3002doFinally \u53ef\u4ee5\u96c6\u4e2d\u5904\u7406\u6d41\u7ec8\u6b62\u540e\u7684\u6e05\u7406&#xff0c;\u4f7f\u4e34\u65f6\u72b6\u6001\u7684\u751f\u547d\u5468\u671f\u4e0e\u751f\u6210\u4efb\u52a1\u4fdd\u6301\u4e00\u81f4\u3002<\/p>\n<hr \/>\n<h2>\u4e94\u3001Generation ID \u7684\u4efb\u52a1\u7ea7\u63a7\u5236<\/h2>\n<p>\u4f7f\u7528 Session ID \u5df2\u7ecf\u80fd\u591f\u89e3\u51b3\u591a\u7528\u6237\u95ee\u9898&#xff0c;\u4f46\u5b83\u4ecd\u7136\u5c5e\u4e8e\u4f1a\u8bdd\u7ea7\u6807\u8bc6\u3002\u4e00\u4e2a Session \u4e2d\u53ef\u80fd\u8fde\u7eed\u53d1\u751f\u591a\u6b21\u8bf7\u6c42&#xff0c;\u4e5f\u53ef\u80fd\u51fa\u73b0\u91cd\u65b0\u751f\u6210\u3001\u91cd\u8bd5\u751a\u81f3\u5e76\u884c\u751f\u6210\u3002\u5982\u679c\u505c\u6b62\u72b6\u6001\u53ea\u7ed1\u5b9a Session ID&#xff0c;\u7c92\u5ea6\u4ecd\u7136\u8fc7\u7c97\u3002<\/p>\n<p>\u66f4\u51c6\u786e\u7684\u65b9\u6848&#xff0c;\u662f\u4e3a\u6bcf\u4e00\u6b21\u5b9e\u9645\u751f\u6210\u4efb\u52a1\u521b\u5efa\u72ec\u7acb\u7684 Generation ID&#xff1a;<\/p>\n<p>sessionId &#061; S001<\/p>\n<p>generationId &#061; G101<br \/>\ngenerationId &#061; G102<\/p>\n<p>\u8fd0\u884c\u72b6\u6001\u6539\u4e3a&#xff1a;<\/p>\n<p>G101 \u2192 RUNNING<br \/>\nG102 \u2192 RUNNING<\/p>\n<p>\u7528\u6237\u505c\u6b62 G101 \u65f6&#xff0c;\u53ea\u5f71\u54cd\u5bf9\u5e94\u751f\u6210\u4efb\u52a1&#xff0c;G102 \u53ef\u4ee5\u7ee7\u7eed\u6267\u884c\u3002Session ID \u7ee7\u7eed\u8868\u793a\u4e1a\u52a1\u4f1a\u8bdd&#xff0c;Generation ID \u4e13\u95e8\u8868\u793a\u4e00\u6b21\u8fd0\u884c\u4e2d\u7684\u751f\u6210\u4efb\u52a1\u3002<\/p>\n<p>\u56e0\u6b64&#xff0c;\u7cfb\u7edf\u590d\u6742\u5ea6\u63d0\u5347\u4ee5\u540e&#xff0c;\u53ef\u4ee5\u8fdb\u4e00\u6b65\u5f62\u6210&#xff1a;<\/p>\n<p>User<br \/>\n  \u2193<br \/>\nSession<br \/>\n  \u2193<br \/>\nRequest<br \/>\n  \u2193<br \/>\nGeneration<\/p>\n<p>\u505c\u6b62\u751f\u6210\u5e94\u8be5\u5c3d\u91cf\u7ed1\u5b9a\u5230\u5b9e\u9645\u9700\u8981\u88ab\u63a7\u5236\u7684 Generation&#xff0c;\u800c\u4e0d\u662f\u6574\u4e2a Session\u3002<\/p>\n<hr \/>\n<h2>\u516d\u3001\u591a\u5b9e\u4f8b\u90e8\u7f72\u4e2d\u7684\u5171\u4eab\u72b6\u6001<\/h2>\n<p>ConcurrentHashMap \u53ea\u80fd\u89e3\u51b3\u5355\u4e2a JVM \u5185\u90e8\u7684\u5e76\u53d1\u3002\u5982\u679c AI Service \u90e8\u7f72\u591a\u4e2a\u5b9e\u4f8b&#xff0c;\u65b0\u7684\u95ee\u9898\u4f1a\u518d\u6b21\u51fa\u73b0\u3002<\/p>\n<p>\u5047\u8bbe G101 \u5b9e\u9645\u8fd0\u884c\u5728\u5b9e\u4f8b A&#xff0c;\u800c\u7528\u6237\u70b9\u51fb Stop \u540e&#xff0c;\u8bf7\u6c42\u88ab Gateway \u5206\u914d\u5230\u5b9e\u4f8b B\u3002\u5b9e\u4f8b B \u7684\u672c\u5730 Map \u4e2d\u5e76\u6ca1\u6709 G101&#xff0c;\u56e0\u6b64\u5b83\u65e0\u6cd5\u4fee\u6539\u5b9e\u4f8b A \u7684\u8fd0\u884c\u72b6\u6001\u3002<\/p>\n<p>\u8fd9\u65f6<span style=\"color:#be191c\">\u9700\u8981\u628a\u4efb\u52a1\u72b6\u6001\u653e\u5230\u591a\u4e2a\u5b9e\u4f8b\u5171\u540c\u8bbf\u95ee\u7684\u5b58\u50a8\u4e2d&#xff0c;\u4f8b\u5982 Redis<\/span>&#xff1a;<\/p>\n<p>ai:generation:G101 \u2192 RUNNING<\/p>\n<p>Stop \u8bf7\u6c42\u53ef\u4ee5\u66f4\u65b0\u4e3a STOPPED&#xff0c;\u6216\u8005\u6839\u636e\u8bbe\u8ba1\u76f4\u63a5\u5220\u9664&#xff0c;\u540c\u65f6\u8bbe\u7f6e TTL&#xff0c;\u907f\u514d\u5f02\u5e38\u4efb\u52a1\u6c38\u4e45\u6b8b\u7559\u3002<\/p>\n<p>Redis \u5728\u8fd9\u91cc\u89e3\u51b3\u7684\u662f\u201c<span style=\"color:#be191c\">\u591a\u4e2a\u670d\u52a1\u5b9e\u4f8b\u5171\u4eab\u4efb\u52a1\u72b6\u6001<\/span>\u201d\u3002\u5b83\u5e76\u4e0d\u4f1a\u81ea\u52a8\u6301\u6709\u771f\u6b63\u8fd0\u884c\u4e2d\u7684 Flux\u3002\u5b9e\u9645\u751f\u6210\u4efb\u52a1\u4ecd\u7136\u5b58\u5728\u4e8e\u67d0\u4e2a\u5177\u4f53 JVM \u4e2d&#xff0c;\u56e0\u6b64\u7cfb\u7edf\u89c4\u6a21\u7ee7\u7eed\u589e\u5927\u540e&#xff0c;\u8fd8\u53ef\u4ee5\u589e\u52a0<span style=\"color:#1c7331\">\u6d88\u606f\u901a\u77e5\u673a\u5236<\/span>&#xff0c;\u8ba9\u6536\u5230 Stop \u8bf7\u6c42\u7684\u5b9e\u4f8b\u901a\u77e5\u771f\u6b63\u6301\u6709 G101 \u7684\u6267\u884c\u8282\u70b9\u5b8c\u6210\u53d6\u6d88\u3002<\/p>\n<hr \/>\n<h2>\u4e03\u3001\u751f\u6210\u4efb\u52a1\u7684\u72b6\u6001\u6a21\u578b<\/h2>\n<p>\u7cfb\u7edf\u8fdb\u4e00\u6b65\u5de5\u7a0b\u5316\u4ee5\u540e&#xff0c;\u5355\u7eaf\u7684 RUNNING \u548c STOPPED \u53ef\u80fd\u4ecd\u7136\u4e0d\u591f\u3002\u4e00\u6b21\u751f\u6210\u4efb\u52a1\u8fd8\u53ef\u80fd\u7ecf\u5386\u521b\u5efa\u3001\u8fd0\u884c\u3001\u8bf7\u6c42\u505c\u6b62\u3001\u6b63\u5e38\u5b8c\u6210\u3001\u6267\u884c\u5931\u8d25\u548c\u53d6\u6d88\u7b49\u9636\u6bb5&#xff1a;<\/p>\n<p>CREATED<br \/>\n   \u2193<br \/>\nRUNNING<br \/>\n   \u2193<br \/>\nSTOP_REQUESTED<br \/>\n   \u2193<br \/>\nCANCELLED<\/p>\n<p>\u6216\u8005&#xff1a;<\/p>\n<p>RUNNING \u2192 COMPLETED<br \/>\nRUNNING \u2192 FAILED<\/p>\n<p>\u663e\u5f0f\u72b6\u6001\u6a21\u578b\u80fd\u591f\u66f4\u51c6\u786e\u5730\u5904\u7406\u7ade\u6001\u3002\u4f8b\u5982\u7528\u6237\u70b9\u51fb Stop \u7684\u540c\u65f6\u6a21\u578b\u521a\u597d\u81ea\u7136\u7ed3\u675f&#xff0c;\u6216\u8005\u524d\u7aef\u8fde\u7eed\u53d1\u9001\u4e24\u6b21\u505c\u6b62\u8bf7\u6c42&#xff0c;\u90fd\u9700\u8981\u7cfb\u7edf\u660e\u786e\u5f53\u524d\u4efb\u52a1\u5df2\u7ecf\u5904\u4e8e\u4ec0\u4e48\u72b6\u6001\u3002<\/p>\n<p>\u6b64\u65f6 Stop \u63a5\u53e3\u4e5f\u5e94\u8be5\u5c3d\u91cf\u8bbe\u8ba1\u6210\u5e42\u7b49\u64cd\u4f5c\u3002\u4efb\u52a1\u5df2\u7ecf\u5b8c\u6210\u65f6\u518d\u6b21 Stop&#xff0c;\u53ef\u4ee5\u76f4\u63a5\u8fd4\u56de\u5f53\u524d\u7ec8\u6001&#xff0c;\u800c\u4e0d\u662f\u4ea7\u751f\u65b0\u7684\u5f02\u5e38\u3002<\/p>\n<hr \/>\n<h2>\u516b\u3001\u603b\u7ed3<\/h2>\n<p>\u505c\u6b62\u751f\u6210\u7684\u8bbe\u8ba1\u5b9e\u9645\u4e0a\u662f\u4e00\u6761\u975e\u5e38\u5b8c\u6574\u7684\u5de5\u7a0b\u6f14\u8fdb\u8def\u5f84\u3002<span style=\"color:#1a439c\">\u5355\u7528\u6237 Demo \u53ef\u4ee5\u4f7f\u7528 boolean&#xff1b;\u8fdb\u5165\u591a\u7528\u6237\u540e&#xff0c;\u9700\u8981\u628a\u72b6\u6001\u4e0e Session \u5173\u8054&#xff1b;\u5e76\u53d1\u8bfb\u5199\u8981\u6c42\u7ebf\u7a0b\u5b89\u5168\u5bb9\u5668&#xff1b;\u540c\u4e00\u4e2a Session \u51fa\u73b0\u591a\u4e2a\u751f\u6210\u4efb\u52a1\u540e&#xff0c;\u9700\u8981\u8fdb\u4e00\u6b65\u5f15\u5165 Generation ID&#xff1b;\u670d\u52a1\u8fdb\u884c\u591a\u5b9e\u4f8b\u90e8\u7f72\u4ee5\u540e&#xff0c;\u672c\u5730 Map \u53c8\u9700\u8981\u6f14\u5316\u4e3a Redis \u7b49\u5171\u4eab\u72b6\u6001\u673a\u5236<\/span>\u3002<\/p>\n<p>\u6574\u4e2a\u8fc7\u7a0b\u4f53\u73b0\u7684\u91cd\u70b9\u5e76\u4e0d\u662f Redis \u6216 Reactor API \u672c\u8eab&#xff0c;\u800c\u662f\u72b6\u6001\u7c92\u5ea6\u548c\u90e8\u7f72\u73af\u5883\u4e0d\u65ad\u53d8\u5316\u4ee5\u540e&#xff0c;\u539f\u6709\u65b9\u6848\u4f1a\u5728\u54ea\u4e2a\u4f4d\u7f6e\u5931\u6548\u3002<\/p>\n<p>\u4e00\u4e2a\u7a33\u5b9a\u7684\u8bbe\u8ba1\u539f\u5219\u662f&#xff1a;\u8fd0\u884c\u72b6\u6001\u5e94\u8be5\u7ed1\u5b9a\u5230\u771f\u6b63\u9700\u8981\u63a7\u5236\u7684\u4efb\u52a1\u5bf9\u8c61&#xff0c;\u4e34\u65f6\u72b6\u6001\u5e94\u8be5\u8ddf\u968f\u4efb\u52a1\u751f\u547d\u5468\u671f\u521b\u5efa\u548c\u6e05\u7406&#xff0c;\u90e8\u7f72\u8303\u56f4\u6269\u5927\u4ee5\u540e\u518d\u9009\u62e9\u5bf9\u5e94\u8303\u56f4\u7684\u5171\u4eab\u673a\u5236\u3002 \u53ea\u8981\u8fd9\u4e09\u4e2a\u8fb9\u754c\u660e\u786e&#xff0c;\u505c\u6b62\u751f\u6210\u3001\u4efb\u52a1\u53d6\u6d88\u548c\u540e\u7eed\u7684 Agent Run \u7ba1\u7406\u90fd\u53ef\u4ee5\u6cbf\u7740\u540c\u4e00\u5957\u601d\u8def\u7ee7\u7eed\u6269\u5c55\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u505c\u6b62\u751f\u6210\u7684\u63a7\u5236\u8fb9\u754c\u6d41\u5f0f\u804a\u5929\u4e2d&#xff0c;\u201c\u505c\u6b62\u751f\u6210\u201d\u770b\u8d77\u6765\u53ea\u662f\u4e00\u4e2a\u6309\u94ae&#xff0c;\u540e\u7aef\u5904\u7406\u7684\u5374\u662f\u4e00\u4e2a\u6301\u7eed\u8fd0\u884c\u7684\u751f\u6210\u4efb\u52a1\u3002\u7528\u6237\u70b9\u51fb\u505c\u6b62\u540e&#xff0c;\u6700\u76f4\u63a5\u7684\u76ee\u6807\u662f\u8ba9\u540e\u7eed\u6a21\u578b\u5185\u5bb9\u4e0d\u518d\u7ee7\u7eed\u53d1\u9001\u5230\u524d\u7aef&#xff0c;\u56e0\u6b64\u5e94\u7528\u9700\u8981\u63a7\u5236\u5f53\u524d Reactive \u6d41\u7684\u751f\u547d\u5468\u671f\u3002\u8fd9\u91cc\u9996\u5148\u8981\u533a\u5206\u4e24\u4e2a\u5c42\u6b21\u3002\u7b2c\u4e00\u5c42\u662f\u5e94\u7528\u4fa7\u505c\u6b62\u8f93\u51fa&#xff0c;\u5373\u540e\u7aef\u7ec8\u6b62\u5f53\u524d Flux&#xff0c;\u8ba9\u540e\u7eed chunk \u4e0d\u518d\u7ee7\u7eed\u5411\u5ba2\u6237\u7aef\u4f20\u9012&#xff1b;\u7b2c\u4e8c\u5c42\u662f\u6a21\u578b Provider \u662f\u5426\u771f\u6b63\u505c\u6b62<\/p>\n","protected":false},"author":2,"featured_media":112434,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[12777,11653,99,105,101,664],"topic":[],"class_list":["post-112435","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-generationid","tag-11653","tag-java","tag-redis","tag-spring","tag-664"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Spring AI \u505c\u6b62\u751f\u6210\u8bbe\u8ba1\uff1a\u4ece\u8fdb\u7a0b\u5185\u72b6\u6001\u5230\u5206\u5e03\u5f0f\u4efb\u52a1\u63a7\u5236 - \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\/112435.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring AI \u505c\u6b62\u751f\u6210\u8bbe\u8ba1\uff1a\u4ece\u8fdb\u7a0b\u5185\u72b6\u6001\u5230\u5206\u5e03\u5f0f\u4efb\u52a1\u63a7\u5236 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001\u505c\u6b62\u751f\u6210\u7684\u63a7\u5236\u8fb9\u754c\u6d41\u5f0f\u804a\u5929\u4e2d&#xff0c;\u201c\u505c\u6b62\u751f\u6210\u201d\u770b\u8d77\u6765\u53ea\u662f\u4e00\u4e2a\u6309\u94ae&#xff0c;\u540e\u7aef\u5904\u7406\u7684\u5374\u662f\u4e00\u4e2a\u6301\u7eed\u8fd0\u884c\u7684\u751f\u6210\u4efb\u52a1\u3002\u7528\u6237\u70b9\u51fb\u505c\u6b62\u540e&#xff0c;\u6700\u76f4\u63a5\u7684\u76ee\u6807\u662f\u8ba9\u540e\u7eed\u6a21\u578b\u5185\u5bb9\u4e0d\u518d\u7ee7\u7eed\u53d1\u9001\u5230\u524d\u7aef&#xff0c;\u56e0\u6b64\u5e94\u7528\u9700\u8981\u63a7\u5236\u5f53\u524d Reactive \u6d41\u7684\u751f\u547d\u5468\u671f\u3002\u8fd9\u91cc\u9996\u5148\u8981\u533a\u5206\u4e24\u4e2a\u5c42\u6b21\u3002\u7b2c\u4e00\u5c42\u662f\u5e94\u7528\u4fa7\u505c\u6b62\u8f93\u51fa&#xff0c;\u5373\u540e\u7aef\u7ec8\u6b62\u5f53\u524d Flux&#xff0c;\u8ba9\u540e\u7eed chunk \u4e0d\u518d\u7ee7\u7eed\u5411\u5ba2\u6237\u7aef\u4f20\u9012&#xff1b;\u7b2c\u4e8c\u5c42\u662f\u6a21\u578b Provider \u662f\u5426\u771f\u6b63\u505c\u6b62\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/112435.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-03T08:16:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261003081650-6ac0b9f299533.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=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/112435.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/112435.html\",\"name\":\"Spring AI \u505c\u6b62\u751f\u6210\u8bbe\u8ba1\uff1a\u4ece\u8fdb\u7a0b\u5185\u72b6\u6001\u5230\u5206\u5e03\u5f0f\u4efb\u52a1\u63a7\u5236 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-03T08:16:53+00:00\",\"dateModified\":\"2026-10-03T08:16:53+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/112435.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/112435.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/112435.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Spring AI \u505c\u6b62\u751f\u6210\u8bbe\u8ba1\uff1a\u4ece\u8fdb\u7a0b\u5185\u72b6\u6001\u5230\u5206\u5e03\u5f0f\u4efb\u52a1\u63a7\u5236\"}]},{\"@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":"Spring AI \u505c\u6b62\u751f\u6210\u8bbe\u8ba1\uff1a\u4ece\u8fdb\u7a0b\u5185\u72b6\u6001\u5230\u5206\u5e03\u5f0f\u4efb\u52a1\u63a7\u5236 - \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\/112435.html","og_locale":"zh_CN","og_type":"article","og_title":"Spring AI \u505c\u6b62\u751f\u6210\u8bbe\u8ba1\uff1a\u4ece\u8fdb\u7a0b\u5185\u72b6\u6001\u5230\u5206\u5e03\u5f0f\u4efb\u52a1\u63a7\u5236 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e00\u3001\u505c\u6b62\u751f\u6210\u7684\u63a7\u5236\u8fb9\u754c\u6d41\u5f0f\u804a\u5929\u4e2d&#xff0c;\u201c\u505c\u6b62\u751f\u6210\u201d\u770b\u8d77\u6765\u53ea\u662f\u4e00\u4e2a\u6309\u94ae&#xff0c;\u540e\u7aef\u5904\u7406\u7684\u5374\u662f\u4e00\u4e2a\u6301\u7eed\u8fd0\u884c\u7684\u751f\u6210\u4efb\u52a1\u3002\u7528\u6237\u70b9\u51fb\u505c\u6b62\u540e&#xff0c;\u6700\u76f4\u63a5\u7684\u76ee\u6807\u662f\u8ba9\u540e\u7eed\u6a21\u578b\u5185\u5bb9\u4e0d\u518d\u7ee7\u7eed\u53d1\u9001\u5230\u524d\u7aef&#xff0c;\u56e0\u6b64\u5e94\u7528\u9700\u8981\u63a7\u5236\u5f53\u524d Reactive \u6d41\u7684\u751f\u547d\u5468\u671f\u3002\u8fd9\u91cc\u9996\u5148\u8981\u533a\u5206\u4e24\u4e2a\u5c42\u6b21\u3002\u7b2c\u4e00\u5c42\u662f\u5e94\u7528\u4fa7\u505c\u6b62\u8f93\u51fa&#xff0c;\u5373\u540e\u7aef\u7ec8\u6b62\u5f53\u524d Flux&#xff0c;\u8ba9\u540e\u7eed chunk \u4e0d\u518d\u7ee7\u7eed\u5411\u5ba2\u6237\u7aef\u4f20\u9012&#xff1b;\u7b2c\u4e8c\u5c42\u662f\u6a21\u578b Provider \u662f\u5426\u771f\u6b63\u505c\u6b62","og_url":"https:\/\/www.wsisp.com\/helps\/112435.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-03T08:16:53+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261003081650-6ac0b9f299533.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/112435.html","url":"https:\/\/www.wsisp.com\/helps\/112435.html","name":"Spring AI \u505c\u6b62\u751f\u6210\u8bbe\u8ba1\uff1a\u4ece\u8fdb\u7a0b\u5185\u72b6\u6001\u5230\u5206\u5e03\u5f0f\u4efb\u52a1\u63a7\u5236 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-03T08:16:53+00:00","dateModified":"2026-10-03T08:16:53+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/112435.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/112435.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/112435.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Spring AI \u505c\u6b62\u751f\u6210\u8bbe\u8ba1\uff1a\u4ece\u8fdb\u7a0b\u5185\u72b6\u6001\u5230\u5206\u5e03\u5f0f\u4efb\u52a1\u63a7\u5236"}]},{"@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\/112435","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=112435"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/112435\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/112434"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=112435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=112435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=112435"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=112435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}