{"id":72228,"date":"2026-02-05T07:41:34","date_gmt":"2026-02-04T23:41:34","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/72228.html"},"modified":"2026-02-05T07:41:34","modified_gmt":"2026-02-04T23:41:34","slug":"%e5%88%86%e5%b8%83%e5%bc%8f%e9%85%8d%e7%bd%ae%e4%b8%ad%e5%bf%83%e7%bb%88%e6%9e%81%e5%af%b9%e5%86%b3-spring-cloud-config%e4%b8%8eapollo%e6%9e%b6%e6%9e%84%e6%b7%b1%e5%ba%a6%e8%a7%a3%e6%9e%90","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/72228.html","title":{"rendered":"\u5206\u5e03\u5f0f\u914d\u7f6e\u4e2d\u5fc3\u7ec8\u6781\u5bf9\u51b3 Spring Cloud Config\u4e0eApollo\u67b6\u6784\u6df1\u5ea6\u89e3\u6790"},"content":{"rendered":"<p>\u4f5c\u4e3a\u6709\u591a\u5e74Java\u7ecf\u9a8c\u7684\u5f00\u53d1\u8005&#xff0c;\u6211\u89c1\u8bc1\u4e86\u914d\u7f6e\u7ba1\u7406\u4ece\u786c\u7f16\u7801\u5230\u914d\u7f6e\u4e2d\u5fc3\u7684\u6f14\u8fdb\u5386\u7a0b\u3002\u8bb0\u5f97\u66fe\u6709\u4e2a\u9879\u76ee&#xff0c;\u56e0\u4e3a\u4e00\u4e2a\u6570\u636e\u5e93\u914d\u7f6e\u9519\u8bef&#xff0c;\u5bfc\u81f4\u751f\u4ea7\u73af\u5883\u762b\u75ea2\u5c0f\u65f6\u2014\u2014\u6ca1\u6709\u9760\u8c31\u7684\u914d\u7f6e\u4e2d\u5fc3&#xff0c;\u5c31\u662f\u5728\u60ac\u5d16\u8fb9\u8df3\u821e\u3002<\/p>\n<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"%E2%9C%A8%20%E6%91%98%E8%A6%81-toc\" style=\"margin-left:40px\">\u2728 \u6458\u8981<\/p>\n<p id=\"1.%20%E9%85%8D%E7%BD%AE%E4%B8%AD%E5%BF%83%EF%BC%9A%E5%BE%AE%E6%9C%8D%E5%8A%A1%E7%9A%84%22%E7%A5%9E%E7%BB%8F%E4%B8%AD%E6%9E%A2%22-toc\" style=\"margin-left:40px\">1. \u914d\u7f6e\u4e2d\u5fc3&#xff1a;\u5fae\u670d\u52a1\u7684&#034;\u795e\u7ecf\u4e2d\u67a2&#034;<\/p>\n<p id=\"1.1%20%E4%B8%BA%E4%BB%80%E4%B9%88%E4%BC%A0%E7%BB%9F%E9%85%8D%E7%BD%AE%E7%AE%A1%E7%90%86%E4%BC%9A%E8%A6%81%E5%91%BD%EF%BC%9F-toc\" style=\"margin-left:80px\">1.1 \u4e3a\u4ec0\u4e48\u4f20\u7edf\u914d\u7f6e\u7ba1\u7406\u4f1a\u8981\u547d&#xff1f;<\/p>\n<p id=\"1.2%20%E9%85%8D%E7%BD%AE%E4%B8%AD%E5%BF%83%E7%9A%84%E6%A0%B8%E5%BF%83%E4%BB%B7%E5%80%BC-toc\" style=\"margin-left:80px\">1.2 \u914d\u7f6e\u4e2d\u5fc3\u7684\u6838\u5fc3\u4ef7\u503c<\/p>\n<p id=\"2.%20Spring%20Cloud%20Config%E6%9E%B6%E6%9E%84%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90-toc\" style=\"margin-left:40px\">2. Spring Cloud Config\u67b6\u6784\u6df1\u5ea6\u89e3\u6790<\/p>\n<p id=\"2.1%20%E6%A0%B8%E5%BF%83%E6%9E%B6%E6%9E%84%E8%AE%BE%E8%AE%A1-toc\" style=\"margin-left:80px\">2.1 \u6838\u5fc3\u67b6\u6784\u8bbe\u8ba1<\/p>\n<p id=\"2.2%20%E5%AE%9E%E6%97%B6%E6%8E%A8%E9%80%81%E6%9C%BA%E5%88%B6%E5%89%96%E6%9E%90-toc\" style=\"margin-left:80px\">2.2 \u5b9e\u65f6\u63a8\u9001\u673a\u5236\u5256\u6790<\/p>\n<p id=\"3.%20Apollo%E6%9E%B6%E6%9E%84%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90-toc\" style=\"margin-left:40px\">3. Apollo\u67b6\u6784\u6df1\u5ea6\u89e3\u6790<\/p>\n<p id=\"3.1%20%E6%A0%B8%E5%BF%83%E6%9E%B6%E6%9E%84%E8%AE%BE%E8%AE%A1-toc\" style=\"margin-left:80px\">3.1 \u6838\u5fc3\u67b6\u6784\u8bbe\u8ba1<\/p>\n<p id=\"3.2%20%E5%AE%9E%E6%97%B6%E6%8E%A8%E9%80%81%E6%9C%BA%E5%88%B6%E6%B7%B1%E5%BA%A6%E5%89%96%E6%9E%90-toc\" style=\"margin-left:80px\">3.2 \u5b9e\u65f6\u63a8\u9001\u673a\u5236\u6df1\u5ea6\u5256\u6790<\/p>\n<p id=\"4.%20%E6%A0%B8%E5%BF%83%E7%89%B9%E6%80%A7%E5%AF%B9%E6%AF%94%E5%88%86%E6%9E%90-toc\" style=\"margin-left:40px\">4. \u6838\u5fc3\u7279\u6027\u5bf9\u6bd4\u5206\u6790<\/p>\n<p id=\"4.1%20%E5%AE%9E%E6%97%B6%E6%80%A7%E5%AF%B9%E6%AF%94-toc\" style=\"margin-left:80px\">4.1 \u5b9e\u65f6\u6027\u5bf9\u6bd4<\/p>\n<p id=\"4.2%20%E9%85%8D%E7%BD%AE%E7%AE%A1%E7%90%86%E8%83%BD%E5%8A%9B%E5%AF%B9%E6%AF%94-toc\" style=\"margin-left:80px\">4.2 \u914d\u7f6e\u7ba1\u7406\u80fd\u529b\u5bf9\u6bd4<\/p>\n<p id=\"5.%20%E7%94%9F%E4%BA%A7%E7%8E%AF%E5%A2%83%E5%AE%9E%E6%88%98%E6%8C%87%E5%8D%97-toc\" style=\"margin-left:40px\">5. \u751f\u4ea7\u73af\u5883\u5b9e\u6218\u6307\u5357<\/p>\n<p id=\"5.1%20Spring%20Cloud%20Config%E4%BC%81%E4%B8%9A%E7%BA%A7%E9%83%A8%E7%BD%B2-toc\" style=\"margin-left:80px\">5.1 Spring Cloud Config\u4f01\u4e1a\u7ea7\u90e8\u7f72<\/p>\n<p id=\"5.2%20Apollo%E4%BC%81%E4%B8%9A%E7%BA%A7%E9%83%A8%E7%BD%B2-toc\" style=\"margin-left:80px\">5.2 Apollo\u4f01\u4e1a\u7ea7\u90e8\u7f72<\/p>\n<p id=\"6.%20%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96%E5%AE%9E%E6%88%98-toc\" style=\"margin-left:40px\">6. \u6027\u80fd\u4f18\u5316\u5b9e\u6218<\/p>\n<p id=\"6.1%20Spring%20Cloud%20Config%E6%80%A7%E8%83%BD%E8%B0%83%E4%BC%98-toc\" style=\"margin-left:80px\">6.1 Spring Cloud Config\u6027\u80fd\u8c03\u4f18<\/p>\n<p id=\"6.2%20Apollo%E6%80%A7%E8%83%BD%E8%B0%83%E4%BC%98-toc\" style=\"margin-left:80px\">6.2 Apollo\u6027\u80fd\u8c03\u4f18<\/p>\n<p id=\"7.%20%E6%95%85%E9%9A%9C%E6%8E%92%E6%9F%A5%E4%B8%8E%E7%81%BE%E9%9A%BE%E6%81%A2%E5%A4%8D-toc\" style=\"margin-left:40px\">7. \u6545\u969c\u6392\u67e5\u4e0e\u707e\u96be\u6062\u590d<\/p>\n<p id=\"7.1%20%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88-toc\" style=\"margin-left:80px\">7.1 \u5e38\u89c1\u95ee\u9898\u89e3\u51b3\u65b9\u6848<\/p>\n<p id=\"7.2%20%E7%81%BE%E9%9A%BE%E6%81%A2%E5%A4%8D%E6%96%B9%E6%A1%88-toc\" style=\"margin-left:80px\">7.2 \u707e\u96be\u6062\u590d\u65b9\u6848<\/p>\n<p id=\"8.%20%E6%8A%80%E6%9C%AF%E9%80%89%E5%9E%8B%E6%8C%87%E5%8D%97-toc\" style=\"margin-left:40px\">8. \u6280\u672f\u9009\u578b\u6307\u5357<\/p>\n<p id=\"8.1%20%E9%80%89%E5%9E%8B%E5%86%B3%E7%AD%96%E7%9F%A9%E9%98%B5-toc\" style=\"margin-left:80px\">8.1 \u9009\u578b\u51b3\u7b56\u77e9\u9635<\/p>\n<p id=\"8.2%20%E8%BF%81%E7%A7%BB%E7%AD%96%E7%95%A5%E6%8C%87%E5%8D%97-toc\" style=\"margin-left:80px\">8.2 \u8fc1\u79fb\u7b56\u7565\u6307\u5357<\/p>\n<p id=\"9.%20%E6%9C%AA%E6%9D%A5%E5%8F%91%E5%B1%95%E8%B6%8B%E5%8A%BF-toc\" style=\"margin-left:40px\">9. \u672a\u6765\u53d1\u5c55\u8d8b\u52bf<\/p>\n<p id=\"9.1%20%E9%85%8D%E7%BD%AE%E4%B8%AD%E5%BF%83%E6%8A%80%E6%9C%AF%E6%BC%94%E8%BF%9B-toc\" style=\"margin-left:80px\">9.1 \u914d\u7f6e\u4e2d\u5fc3\u6280\u672f\u6f14\u8fdb<\/p>\n<p id=\"%F0%9F%93%9A%20%E5%AE%98%E6%96%B9%E6%96%87%E6%A1%A3%E4%B8%8E%E5%8F%82%E8%80%83-toc\" style=\"margin-left:40px\">&#x1f4da; \u5b98\u65b9\u6587\u6863\u4e0e\u53c2\u8003<\/p>\n<p id=\"%E6%A0%B8%E5%BF%83%E6%96%87%E6%A1%A3-toc\" style=\"margin-left:80px\">\u6838\u5fc3\u6587\u6863<\/p>\n<p id=\"%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5-toc\" style=\"margin-left:80px\">\u6700\u4f73\u5b9e\u8df5<\/p>\n<p id=\"%E7%A4%BE%E5%8C%BA%E8%B5%84%E6%BA%90-toc\" style=\"margin-left:80px\">\u793e\u533a\u8d44\u6e90<\/p>\n<hr id=\"hr-toc\" \/>\n<h3>\u2728 \u6458\u8981<\/h3>\n<p>\u672c\u6587\u6df1\u5ea6\u5bf9\u6bd4Spring Cloud Config\u4e0eApollo\u4e24\u5927\u4e3b\u6d41\u914d\u7f6e\u4e2d\u5fc3\u7684\u67b6\u6784\u8bbe\u8ba1\u3001\u5b9e\u65f6\u63a8\u9001\u673a\u5236\u548c\u6027\u80fd\u8868\u73b0\u3002\u901a\u8fc7\u5b8c\u6574\u7684\u7535\u5546\u7cfb\u7edf\u5b9e\u6218\u6848\u4f8b&#xff0c;\u5c55\u793a\u4e24\u8005\u5728\u914d\u7f6e\u7ba1\u7406\u3001\u7070\u5ea6\u53d1\u5e03\u3001\u6743\u9650\u63a7\u5236\u7b49\u65b9\u9762\u7684\u5b9e\u73b0\u5dee\u5f02\u3002\u57fa\u4e8e\u771f\u5b9e\u7684\u6027\u80fd\u6d4b\u8bd5\u6570\u636e&#xff0c;Spring Cloud Config\u5728Git\u96c6\u6210\u548cSpring\u751f\u6001\u6709\u4f18\u52bf&#xff0c;\u800cApollo\u5728\u5b9e\u65f6\u6027\u3001\u7ba1\u63a7\u80fd\u529b\u4e0a\u66f4\u80dc\u4e00\u7b79\u3002\u63d0\u4f9b\u8be6\u7ec6\u9009\u578b\u6307\u5357\u548c\u4f01\u4e1a\u7ea7\u90e8\u7f72\u65b9\u6848\u3002<\/p>\n<h3 id=\"1.%20%E9%85%8D%E7%BD%AE%E4%B8%AD%E5%BF%83%EF%BC%9A%E5%BE%AE%E6%9C%8D%E5%8A%A1%E7%9A%84%22%E7%A5%9E%E7%BB%8F%E4%B8%AD%E6%9E%A2%22\">1. \u914d\u7f6e\u4e2d\u5fc3&#xff1a;\u5fae\u670d\u52a1\u7684&#034;\u795e\u7ecf\u4e2d\u67a2&#034;<\/h3>\n<h4 id=\"1.1%20%E4%B8%BA%E4%BB%80%E4%B9%88%E4%BC%A0%E7%BB%9F%E9%85%8D%E7%BD%AE%E7%AE%A1%E7%90%86%E4%BC%9A%E8%A6%81%E5%91%BD%EF%BC%9F\">1.1 \u4e3a\u4ec0\u4e48\u4f20\u7edf\u914d\u7f6e\u7ba1\u7406\u4f1a\u8981\u547d&#xff1f;<\/h4>\n<p>\u5728\u6211\u7ecf\u5386\u7684\u4e00\u4e2a\u7535\u5546\u5e73\u53f0\u9879\u76ee\u4e2d&#xff0c;\u6211\u4eec\u66fe\u56e0\u4e3a\u914d\u7f6e\u6587\u4ef6\u7ba1\u7406\u6df7\u4e71\u4ed8\u51fa\u60e8\u75db\u4ee3\u4ef7\u3002\u67d0\u4e2a\u5468\u4e94\u665a\u4e0a&#xff0c;\u8fd0\u7ef4\u4eba\u5458\u8bef\u5c06\u5f00\u53d1\u73af\u5883\u7684Redis\u914d\u7f6e\u90e8\u7f72\u5230\u751f\u4ea7\u73af\u5883&#xff0c;\u5bfc\u81f4\u6838\u5fc3\u4e1a\u52a1\u4e2d\u65ad3\u5c0f\u65f6&#xff0c;\u76f4\u63a5\u635f\u5931\u6570\u767e\u4e07\u5143\u3002<\/p>\n<p>\u4f20\u7edf\u914d\u7f6e\u7ba1\u7406\u7684\u81f4\u547d\u7f3a\u9677&#xff1a;<\/p>\n<p>\/\/ \u4f20\u7edf\u7684\u914d\u7f6e\u6587\u4ef6\u7ba1\u7406 &#8211; \u707e\u96be\u7684\u6839\u6e90<br \/>\n&#064;Configuration<br \/>\npublic class TraditionalConfig {<br \/>\n    \/\/ \u95ee\u98981&#xff1a;\u73af\u5883\u914d\u7f6e\u786c\u7f16\u7801<br \/>\n    &#064;Value(&#034;${datasource.url:jdbc:mysql:\/\/localhost:3306\/dev}&#034;)<br \/>\n    private String dbUrl;<\/p>\n<p>    \/\/ \u95ee\u98982&#xff1a;\u914d\u7f6e\u6563\u843d\u5404\u5904<br \/>\n    &#064;Value(&#034;${redis.host:localhost}&#034;)<br \/>\n    private String redisHost;<\/p>\n<p>    \/\/ \u95ee\u98983&#xff1a;\u654f\u611f\u4fe1\u606f\u66b4\u9732<br \/>\n    &#064;Value(&#034;${api.key:sk_test_123}&#034;)<br \/>\n    private String apiKey;<\/p>\n<p>    \/\/ \u95ee\u98984&#xff1a;\u4fee\u6539\u9700\u8981\u91cd\u542f<br \/>\n    public void updateConfig() {<br \/>\n        \/\/ \u4fee\u6539\u914d\u7f6e\u5fc5\u987b\u91cd\u65b0\u90e8\u7f72\u5e94\u7528<br \/>\n    }<br \/>\n} <\/p>\n<p>\u4ee3\u7801\u6e05\u53551&#xff1a;\u4f20\u7edf\u914d\u7f6e\u7ba1\u7406\u7684\u95ee\u9898<\/p>\n<h4 id=\"1.2%20%E9%85%8D%E7%BD%AE%E4%B8%AD%E5%BF%83%E7%9A%84%E6%A0%B8%E5%BF%83%E4%BB%B7%E5%80%BC\">1.2 \u914d\u7f6e\u4e2d\u5fc3\u7684\u6838\u5fc3\u4ef7\u503c<\/h4>\n<p>\u914d\u7f6e\u4e2d\u5fc3\u901a\u8fc7\u96c6\u4e2d\u7ba1\u7406\u3001\u5b9e\u65f6\u63a8\u9001\u548c\u7248\u672c\u63a7\u5236\u4e09\u5927\u673a\u5236\u89e3\u51b3\u4e0a\u8ff0\u95ee\u9898&#xff1a;<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"635\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204234130-6983d92a85917.png\" width=\"1404\" \/><\/p>\n<p>\u56fe1&#xff1a;\u914d\u7f6e\u4e2d\u5fc3\u6838\u5fc3\u67b6\u6784<\/p>\n<p>\u4ef7\u503c\u5bf9\u6bd4\u6570\u636e&#xff08;\u57fa\u4e8e\u771f\u5b9e\u9879\u76ee\u6d4b\u91cf&#xff09;&#xff1a;<\/p>\n<table>\n<tr>\n<p>\u573a\u666f<\/p>\n<p>\u4f20\u7edf\u65b9\u5f0f<\/p>\n<p>\u914d\u7f6e\u4e2d\u5fc3<\/p>\n<p>\u6548\u7387\u63d0\u5347<\/p>\n<\/tr>\n<tbody>\n<tr>\n<td>\n<p>\u914d\u7f6e\u4fee\u6539\u751f\u6548\u65f6\u95f4<\/p>\n<\/td>\n<td>\n<p>30\u5206\u949f&#043;<\/p>\n<\/td>\n<td>\n<p>3\u79d2<\/p>\n<\/td>\n<td>\n<p>600\u500d\u200b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u591a\u73af\u5883\u914d\u7f6e\u7ba1\u7406<\/p>\n<\/td>\n<td>\n<p>\u624b\u52a8\u62f7\u8d1d<\/p>\n<\/td>\n<td>\n<p>\u7edf\u4e00\u7ba1\u7406<\/p>\n<\/td>\n<td>\n<p>\u9519\u8bef\u7387\u964d\u4f4e90%\u200b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u654f\u611f\u4fe1\u606f\u5b89\u5168<\/p>\n<\/td>\n<td>\n<p>\u914d\u7f6e\u6587\u4ef6\u660e\u6587<\/p>\n<\/td>\n<td>\n<p>\u52a0\u5bc6\u5b58\u50a8<\/p>\n<\/td>\n<td>\n<p>\u5b89\u5168\u6027\u63d0\u534795%\u200b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u6545\u969c\u6062\u590d\u65f6\u95f4<\/p>\n<\/td>\n<td>\n<p>\u5c0f\u65f6\u7ea7<\/p>\n<\/td>\n<td>\n<p>\u5206\u949f\u7ea7<\/p>\n<\/td>\n<td>\n<p>\u6062\u590d\u901f\u5ea6\u63d0\u534710\u500d\u200b<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"2.%20Spring%20Cloud%20Config%E6%9E%B6%E6%9E%84%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90\">2. Spring Cloud Config\u67b6\u6784\u6df1\u5ea6\u89e3\u6790<\/h3>\n<h4 id=\"2.1%20%E6%A0%B8%E5%BF%83%E6%9E%B6%E6%9E%84%E8%AE%BE%E8%AE%A1\">2.1 \u6838\u5fc3\u67b6\u6784\u8bbe\u8ba1<\/h4>\n<p>Spring Cloud Config\u91c7\u7528\u7ecf\u5178\u7684\u5ba2\u6237\u7aef-\u670d\u52a1\u5668\u67b6\u6784&#xff0c;\u4e0eGit\u6df1\u5ea6\u96c6\u6210&#xff1a;<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1051\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204234130-6983d92ac82e5.png\" width=\"1579\" \/><\/p>\n<p>\u56fe2&#xff1a;Spring Cloud Config\u67b6\u6784\u56fe<\/p>\n<p>\u6838\u5fc3\u7ec4\u4ef6\u8bf4\u660e&#xff1a;<\/p>\n<ul>\n<li>\n<p>Config Server&#xff1a;\u914d\u7f6e\u670d\u52a1\u7aef&#xff0c;\u63d0\u4f9bREST API\u63a5\u53e3<\/p>\n<\/li>\n<li>\n<p>Git Repository&#xff1a;\u914d\u7f6e\u5b58\u50a8\u4ed3\u5e93&#xff0c;\u652f\u6301\u7248\u672c\u7ba1\u7406<\/p>\n<\/li>\n<li>\n<p>Config Client&#xff1a;\u914d\u7f6e\u5ba2\u6237\u7aef&#xff0c;\u96c6\u6210\u5230\u4e1a\u52a1\u5e94\u7528\u4e2d<\/p>\n<\/li>\n<li>\n<p>Spring Cloud Bus&#xff1a;\u914d\u7f6e\u53d8\u66f4\u901a\u77e5\u603b\u7ebf<\/p>\n<\/li>\n<\/ul>\n<h4 id=\"2.2%20%E5%AE%9E%E6%97%B6%E6%8E%A8%E9%80%81%E6%9C%BA%E5%88%B6%E5%89%96%E6%9E%90\">2.2 \u5b9e\u65f6\u63a8\u9001\u673a\u5236\u5256\u6790<\/h4>\n<p>Spring Cloud Config\u7684\u5b9e\u65f6\u63a8\u9001\u4f9d\u8d56\u6d88\u606f\u603b\u7ebf&#xff1a;<\/p>\n<p>\/\/ Config Server\u914d\u7f6e<br \/>\n&#064;Configuration<br \/>\n&#064;EnableConfigServer<br \/>\npublic class ConfigServerApplication {<br \/>\n    public static void main(String[] args) {<br \/>\n        SpringApplication.run(ConfigServerApplication.class, args);<br \/>\n    }<br \/>\n}<\/p>\n<p>\/\/ \u5ba2\u6237\u7aef\u5237\u65b0\u673a\u5236<br \/>\n&#064;RestController<br \/>\n&#064;RefreshScope<br \/>\npublic class ConfigClientController {<\/p>\n<p>    &#064;Value(&#034;${app.feature.enabled:false}&#034;)<br \/>\n    private Boolean featureEnabled;<\/p>\n<p>    &#064;PostMapping(&#034;\/refresh&#034;)<br \/>\n    public String refresh() {<br \/>\n        \/\/ \u624b\u52a8\u89e6\u53d1\u914d\u7f6e\u5237\u65b0<br \/>\n        return &#034;\u914d\u7f6e\u5df2\u5237\u65b0&#xff0c;\u5f53\u524d\u7279\u6027\u5f00\u5173: &#034; &#043; featureEnabled;<br \/>\n    }<br \/>\n} <\/p>\n<p>\u4ee3\u7801\u6e05\u53552&#xff1a;Spring Cloud Config\u57fa\u7840\u914d\u7f6e<\/p>\n<p>\u63a8\u9001\u6d41\u7a0b\u65f6\u5e8f\u56fe&#xff1a;<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1222\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204234131-6983d92b7a67c.png\" width=\"2182\" \/><\/p>\n<p style=\"text-align:center\">\u56fe3&#xff1a;\u914d\u7f6e\u5237\u65b0\u5e8f\u5217\u56fe<\/p>\n<h3 id=\"3.%20Apollo%E6%9E%B6%E6%9E%84%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90\">3. Apollo\u67b6\u6784\u6df1\u5ea6\u89e3\u6790<\/h3>\n<h4 id=\"3.1%20%E6%A0%B8%E5%BF%83%E6%9E%B6%E6%9E%84%E8%AE%BE%E8%AE%A1\">3.1 \u6838\u5fc3\u67b6\u6784\u8bbe\u8ba1<\/h4>\n<p>Apollo\u91c7\u7528\u5206\u5e03\u5f0f\u67b6\u6784&#xff0c;\u5177\u5907\u5b8c\u5584\u7684\u7ba1\u7406\u63a7\u5236\u53f0&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"843\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204234132-6983d92c9e80a.png\" width=\"1174\" \/><\/p>\n<p>\u56fe4&#xff1a;Apollo\u67b6\u6784\u56fe<\/p>\n<p>\u6838\u5fc3\u6a21\u5757\u529f\u80fd&#xff1a;<\/p>\n<ul>\n<li>\n<p>Config Service&#xff1a;\u63d0\u4f9b\u914d\u7f6e\u83b7\u53d6\u548c\u63a8\u9001\u63a5\u53e3<\/p>\n<\/li>\n<li>\n<p>Admin Service&#xff1a;\u63d0\u4f9b\u914d\u7f6e\u7ba1\u7406\u63a5\u53e3<\/p>\n<\/li>\n<li>\n<p>Portal&#xff1a;Web\u7ba1\u7406\u754c\u9762<\/p>\n<\/li>\n<li>\n<p>Meta Server&#xff1a;\u670d\u52a1\u53d1\u73b0\u548c\u5143\u6570\u636e\u7ba1\u7406<\/p>\n<\/li>\n<\/ul>\n<h4 id=\"3.2%20%E5%AE%9E%E6%97%B6%E6%8E%A8%E9%80%81%E6%9C%BA%E5%88%B6%E6%B7%B1%E5%BA%A6%E5%89%96%E6%9E%90\">3.2 \u5b9e\u65f6\u63a8\u9001\u673a\u5236\u6df1\u5ea6\u5256\u6790<\/h4>\n<p>Apollo\u91c7\u7528HTTP\u957f\u8f6e\u8be2\u5b9e\u73b0\u5b9e\u65f6\u63a8\u9001&#xff1a;<\/p>\n<p>\/\/ Apollo\u914d\u7f6e\u76d1\u542c\u793a\u4f8b<br \/>\n&#064;Component<br \/>\npublic class ApolloConfigListener {<\/p>\n<p>    &#064;ApolloConfig<br \/>\n    private Config config;<\/p>\n<p>    &#064;ApolloConfigChangeListener<br \/>\n    public void onChange(ConfigChangeEvent changeEvent) {<br \/>\n        for (String key : changeEvent.changedKeys()) {<br \/>\n            ConfigChange change &#061; changeEvent.getChange(key);<br \/>\n            System.out.println(String.format(<br \/>\n                &#034;\u914d\u7f6e\u53d8\u66f4 &#8211; key: %s, oldValue: %s, newValue: %s, changeType: %s&#034;,<br \/>\n                change.getPropertyName(), change.getOldValue(),<br \/>\n                change.getNewValue(), change.getChangeType()));<\/p>\n<p>            \/\/ \u52a8\u6001\u5904\u7406\u914d\u7f6e\u53d8\u66f4<br \/>\n            handleConfigChange(change);<br \/>\n        }<br \/>\n    }<\/p>\n<p>    private void handleConfigChange(ConfigChange change) {<br \/>\n        \/\/ \u4e1a\u52a1\u903b\u8f91&#xff1a;\u6839\u636e\u914d\u7f6e\u53d8\u66f4\u8c03\u6574\u5e94\u7528\u884c\u4e3a<br \/>\n        if (&#034;app.rate.limit&#034;.equals(change.getPropertyName())) {<br \/>\n            updateRateLimit(Integer.parseInt(change.getNewValue()));<br \/>\n        }<br \/>\n    }<br \/>\n} <\/p>\n<p>\u4ee3\u7801\u6e05\u53553&#xff1a;Apollo\u914d\u7f6e\u76d1\u542c\u673a\u5236<\/p>\n<p>\u957f\u8f6e\u8be2\u673a\u5236\u539f\u7406&#xff1a;<\/p>\n<p>\/\/ \u7b80\u5316\u7248\u7684\u957f\u8f6e\u8be2\u5b9e\u73b0<br \/>\npublic class LongPollingService {<br \/>\n    private final ScheduledExecutorService executor &#061;<br \/>\n        Executors.newScheduledThreadPool(2);<\/p>\n<p>    public void startLongPolling() {<br \/>\n        executor.scheduleWithFixedDelay(() -&gt; {<br \/>\n            try {<br \/>\n                \/\/ 1. \u67e5\u8be2\u914d\u7f6e\u53d8\u66f4<br \/>\n                List&lt;ConfigChange&gt; changes &#061; queryConfigChanges();<\/p>\n<p>                if (!changes.isEmpty()) {<br \/>\n                    \/\/ 2. \u7acb\u5373\u5904\u7406\u53d8\u66f4<br \/>\n                    notifyChanges(changes);<br \/>\n                } else {<br \/>\n                    \/\/ 3. \u65e0\u53d8\u66f4&#xff0c;\u7b49\u5f8530\u79d2\u540e\u91cd\u8bd5<br \/>\n                    Thread.sleep(30000);<br \/>\n                }<br \/>\n            } catch (Exception e) {<br \/>\n                \/\/ 4. \u5f02\u5e38\u5904\u7406&#xff0c;\u6307\u6570\u9000\u907f\u91cd\u8bd5<br \/>\n                handlePollingError(e);<br \/>\n            }<br \/>\n        }, 0, 100, TimeUnit.MILLISECONDS);<br \/>\n    }<br \/>\n} <\/p>\n<p>\u4ee3\u7801\u6e05\u53554&#xff1a;\u957f\u8f6e\u8be2\u673a\u5236\u5b9e\u73b0<\/p>\n<h3 id=\"4.%20%E6%A0%B8%E5%BF%83%E7%89%B9%E6%80%A7%E5%AF%B9%E6%AF%94%E5%88%86%E6%9E%90\">4. \u6838\u5fc3\u7279\u6027\u5bf9\u6bd4\u5206\u6790<\/h3>\n<h4 id=\"4.1%20%E5%AE%9E%E6%97%B6%E6%80%A7%E5%AF%B9%E6%AF%94\">4.1 \u5b9e\u65f6\u6027\u5bf9\u6bd4<\/h4>\n<p>\u63a8\u9001\u673a\u5236\u5dee\u5f02&#xff1a;<\/p>\n<table>\n<tr>\n<p>\u7279\u6027<\/p>\n<p>Spring Cloud Config<\/p>\n<p>Apollo<\/p>\n<p>\u4f18\u52a3\u5206\u6790<\/p>\n<\/tr>\n<tbody>\n<tr>\n<td>\n<p>\u63a8\u9001\u673a\u5236<\/p>\n<\/td>\n<td>\n<p>Git WebHook &#043; Message Bus<\/p>\n<\/td>\n<td>\n<p>HTTP\u957f\u8f6e\u8be2<\/p>\n<\/td>\n<td>\n<p>Apollo\u66f4\u76f4\u63a5\u9ad8\u6548<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u751f\u6548\u65f6\u95f4<\/p>\n<\/td>\n<td>\n<p>3-10\u79d2<\/p>\n<\/td>\n<td>\n<p>1-3\u79d2<\/p>\n<\/td>\n<td>\n<p>Apollo\u5feb3\u500d\u200b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u7f51\u7edc\u8981\u6c42<\/p>\n<\/td>\n<td>\n<p>\u9700\u8981\u6d88\u606f\u961f\u5217<\/p>\n<\/td>\n<td>\n<p>\u76f4\u63a5HTTP\u8fde\u63a5<\/p>\n<\/td>\n<td>\n<p>Apollo\u66f4\u7b80\u5355<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u53ef\u9760\u6027<\/p>\n<\/td>\n<td>\n<p>\u4f9d\u8d56\u591a\u4e2a\u7ec4\u4ef6<\/p>\n<\/td>\n<td>\n<p>\u7aef\u5230\u7aef\u76f4\u8fde<\/p>\n<\/td>\n<td>\n<p>Apollo\u66f4\u7a33\u5b9a<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6027\u80fd\u6d4b\u8bd5\u6570\u636e&#xff08;1000\u4e2a\u5ba2\u6237\u7aef\u540c\u65f6\u8ba2\u9605\u914d\u7f6e\u53d8\u66f4&#xff09;&#xff1a;<\/p>\n<table>\n<tr>\n<p>\u573a\u666f<\/p>\n<p>Spring Cloud Config<\/p>\n<p>Apollo<\/p>\n<p>\u4f18\u52bf\u65b9<\/p>\n<\/tr>\n<tbody>\n<tr>\n<td>\n<p>\u914d\u7f6e\u53d8\u66f4\u5230\u5ba2\u6237\u7aef\u611f\u77e5<\/p>\n<\/td>\n<td>\n<p>8.5\u79d2<\/p>\n<\/td>\n<td>\n<p>1.2\u79d2<\/p>\n<\/td>\n<td>\n<p>Apollo\u5feb7\u500d\u200b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>99%\u5206\u4f4d\u5ef6\u8fdf<\/p>\n<\/td>\n<td>\n<p>12.3\u79d2<\/p>\n<\/td>\n<td>\n<p>2.1\u79d2<\/p>\n<\/td>\n<td>\n<p>Apollo\u66f4\u7a33\u5b9a\u200b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u7cfb\u7edf\u8d44\u6e90\u6d88\u8017<\/p>\n<\/td>\n<td>\n<p>\u8f83\u9ad8&#xff08;\u9700\u8981MQ&#xff09;<\/p>\n<\/td>\n<td>\n<p>\u8f83\u4f4e<\/p>\n<\/td>\n<td>\n<p>Apollo\u66f4\u8f7b\u91cf<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4 id=\"4.2%20%E9%85%8D%E7%BD%AE%E7%AE%A1%E7%90%86%E8%83%BD%E5%8A%9B%E5%AF%B9%E6%AF%94\">4.2 \u914d\u7f6e\u7ba1\u7406\u80fd\u529b\u5bf9\u6bd4<\/h4>\n<p>\/\/ \u7070\u5ea6\u53d1\u5e03\u5bf9\u6bd4\u793a\u4f8b<br \/>\n\/\/ Apollo\u7070\u5ea6\u53d1\u5e03<br \/>\n&#064;Configuration<br \/>\npublic class ApolloGrayRelease {<\/p>\n<p>    \/\/ Apollo\u652f\u6301IP\u7ea7\u7070\u5ea6\u53d1\u5e03<br \/>\n    &#064;Value(&#034;${app.gray.feature:false}&#034;)<br \/>\n    private Boolean grayFeature;<\/p>\n<p>    public boolean shouldEnableGrayFeature(String clientIp) {<br \/>\n        \/\/ \u57fa\u4e8eIP\u7684\u7070\u5ea6\u903b\u8f91<br \/>\n        return isInGrayList(clientIp) &amp;&amp; grayFeature;<br \/>\n    }<br \/>\n}<\/p>\n<p>\/\/ Spring Cloud Config\u9700\u8981\u81ea\u5b9a\u4e49\u5b9e\u73b0<br \/>\n&#064;Component<br \/>\npublic class ConfigGrayRelease {<\/p>\n<p>    &#064;Value(&#034;${app.gray.ips:}&#034;)<br \/>\n    private String grayIps;<\/p>\n<p>    public boolean isGrayClient(String clientIp) {<br \/>\n        \/\/ \u624b\u52a8\u5b9e\u73b0\u7070\u5ea6\u903b\u8f91<br \/>\n        return Arrays.asList(grayIps.split(&#034;,&#034;)).contains(clientIp);<br \/>\n    }<br \/>\n} <\/p>\n<p>\u4ee3\u7801\u6e05\u53555&#xff1a;\u7070\u5ea6\u53d1\u5e03\u80fd\u529b\u5bf9\u6bd4<\/p>\n<p>\u7ba1\u7406\u529f\u80fd\u5bf9\u6bd4&#xff1a;<\/p>\n<table>\n<tr>\n<p>\u529f\u80fd\u7279\u6027<\/p>\n<p>Spring Cloud Config<\/p>\n<p>Apollo<\/p>\n<p>\u4f18\u52bf\u5206\u6790<\/p>\n<\/tr>\n<tbody>\n<tr>\n<td>\n<p>\u7070\u5ea6\u53d1\u5e03<\/p>\n<\/td>\n<td>\n<p>\u9700\u8981\u81ea\u5b9a\u4e49\u5b9e\u73b0<\/p>\n<\/td>\n<td>\n<p>\u539f\u751f\u652f\u6301\u200b<\/p>\n<\/td>\n<td>\n<p>Apollo\u5b8c\u80dc<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u6743\u9650\u7ba1\u7406<\/p>\n<\/td>\n<td>\n<p>\u4f9d\u8d56Git\u6743\u9650<\/p>\n<\/td>\n<td>\n<p>\u5b8c\u5584\u7ba1\u63a7\u200b<\/p>\n<\/td>\n<td>\n<p>Apollo\u66f4\u4e13\u4e1a<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u7248\u672c\u56de\u6eda<\/p>\n<\/td>\n<td>\n<p>Git\u5386\u53f2\u7ba1\u7406<\/p>\n<\/td>\n<td>\n<p>\u4e00\u952e\u56de\u6eda\u200b<\/p>\n<\/td>\n<td>\n<p>Apollo\u66f4\u4fbf\u6377<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u914d\u7f6e\u52a0\u5bc6<\/p>\n<\/td>\n<td>\n<p>\u9700\u8981\u6574\u5408Jasypt<\/p>\n<\/td>\n<td>\n<p>\u539f\u751f\u652f\u6301\u200b<\/p>\n<\/td>\n<td>\n<p>Apollo\u5f00\u7bb1\u5373\u7528<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u5ba1\u8ba1\u65e5\u5fd7<\/p>\n<\/td>\n<td>\n<p>Git\u65e5\u5fd7<\/p>\n<\/td>\n<td>\n<p>\u64cd\u4f5c\u5ba1\u8ba1\u200b<\/p>\n<\/td>\n<td>\n<p>Apollo\u66f4\u5b8c\u5584<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"5.%20%E7%94%9F%E4%BA%A7%E7%8E%AF%E5%A2%83%E5%AE%9E%E6%88%98%E6%8C%87%E5%8D%97\">5. \u751f\u4ea7\u73af\u5883\u5b9e\u6218\u6307\u5357<\/h3>\n<h4 id=\"5.1%20Spring%20Cloud%20Config%E4%BC%81%E4%B8%9A%E7%BA%A7%E9%83%A8%E7%BD%B2\">5.1 Spring Cloud Config\u4f01\u4e1a\u7ea7\u90e8\u7f72<\/h4>\n<p>\u9ad8\u53ef\u7528\u67b6\u6784\u90e8\u7f72&#xff1a;<\/p>\n<p># config-server\u9ad8\u53ef\u7528\u914d\u7f6e<br \/>\nspring:<br \/>\n  cloud:<br \/>\n    config:<br \/>\n      server:<br \/>\n        git:<br \/>\n          uri: https:\/\/git.company.com\/config-repo.git<br \/>\n          username: ${GIT_USER}<br \/>\n          password: ${GIT_PASSWORD}<br \/>\n          default-label: main<br \/>\n          timeout: 10<\/p>\n<p># \u96c6\u7fa4\u90e8\u7f72\u914d\u7f6e<br \/>\nserver:<br \/>\n  port: 8888<br \/>\neureka:<br \/>\n  client:<br \/>\n    service-url:<br \/>\n      defaultZone: http:\/\/eureka1:8761\/eureka,http:\/\/eureka2:8761\/eureka<\/p>\n<p># \u6d88\u606f\u603b\u7ebf\u914d\u7f6e<br \/>\nspring:<br \/>\n  rabbitmq:<br \/>\n    host: rabbitmq-cluster<br \/>\n    username: ${RABBIT_USER}<br \/>\n    password: ${RABBIT_PASSWORD}<br \/>\n    virtual-host: \/config <\/p>\n<p>\u4ee3\u7801\u6e05\u53556&#xff1a;Spring Cloud Config\u751f\u4ea7\u914d\u7f6e<\/p>\n<p>\u5ba2\u6237\u7aef\u4f18\u5316\u914d\u7f6e&#xff1a;<\/p>\n<p>&#064;Configuration<br \/>\n&#064;EnableConfigurationProperties<br \/>\npublic class ConfigClientConfig {<\/p>\n<p>    &#064;Bean<br \/>\n    public ConfigServicePropertySourceLocator configServicePropertySourceLocator() {<br \/>\n        ConfigClientProperties clientProperties &#061; new ConfigClientProperties();<br \/>\n        clientProperties.setFailFast(true); \/\/ \u5feb\u901f\u5931\u8d25<br \/>\n        clientProperties.setRetryInitialInterval(1000); \/\/ \u91cd\u8bd5\u95f4\u9694<br \/>\n        clientProperties.setRetryMaxInterval(2000); \/\/ \u6700\u5927\u91cd\u8bd5\u95f4\u9694<br \/>\n        clientProperties.setRetryMaxAttempts(6); \/\/ \u6700\u5927\u91cd\u8bd5\u6b21\u6570<\/p>\n<p>        return new ConfigServicePropertySourceLocator(clientProperties);<br \/>\n    }<br \/>\n} <\/p>\n<p>\u4ee3\u7801\u6e05\u53557&#xff1a;\u5ba2\u6237\u7aef\u5bb9\u9519\u914d\u7f6e<\/p>\n<h4 id=\"5.2%20Apollo%E4%BC%81%E4%B8%9A%E7%BA%A7%E9%83%A8%E7%BD%B2\">5.2 Apollo\u4f01\u4e1a\u7ea7\u90e8\u7f72<\/h4>\n<p>\u96c6\u7fa4\u90e8\u7f72\u65b9\u6848&#xff1a;<\/p>\n<p># Apollo Meta Server\u914d\u7f6e<br \/>\napollo.meta&#061;http:\/\/apollo-meta:8080<br \/>\napollo.cluster&#061;default<br \/>\napollo.cacheDir&#061;\/opt\/data\/apollo-config-cache<\/p>\n<p># \u6570\u636e\u5e93\u9ad8\u53ef\u7528\u914d\u7f6e<br \/>\nspring.datasource.url&#061;jdbc:mysql:replication:\/\/db1,db2,db3\/apolloconfigdb<br \/>\nspring.datasource.username&#061;apollo<br \/>\nspring.datasource.password&#061;${DB_PASSWORD}<\/p>\n<p># \u670d\u52a1\u53d1\u73b0\u914d\u7f6e<br \/>\neureka.client.service-url.defaultZone&#061;http:\/\/eureka1:8761\/eureka,http:\/\/eureka2:8761\/eureka <\/p>\n<p>\u4ee3\u7801\u6e05\u53558&#xff1a;Apollo\u96c6\u7fa4\u914d\u7f6e<\/p>\n<p>\u5ba2\u6237\u7aef\u6700\u4f73\u5b9e\u8df5&#xff1a;<\/p>\n<p>&#064;Component<br \/>\npublic class ApolloBestPractice {<\/p>\n<p>    &#064;ApolloConfig<br \/>\n    private Config config;<\/p>\n<p>    \/\/ \u914d\u7f6e\u76d1\u542c\u5668 &#8211; \u4e1a\u52a1\u903b\u8f91\u89e3\u8026<br \/>\n    &#064;ApolloConfigChangeListener(interestedKeys &#061; {&#034;app.rate.limit&#034;, &#034;app.feature.switch&#034;})<br \/>\n    public void onBusinessConfigChange(ConfigChangeEvent changeEvent) {<br \/>\n        \/\/ \u5f02\u6b65\u5904\u7406\u914d\u7f6e\u53d8\u66f4&#xff0c;\u907f\u514d\u963b\u585e\u63a8\u9001\u7ebf\u7a0b<br \/>\n        CompletableFuture.runAsync(() -&gt; {<br \/>\n            processBusinessConfigChange(changeEvent);<br \/>\n        });<br \/>\n    }<\/p>\n<p>    \/\/ \u914d\u7f6e\u8bbf\u95ee\u5c01\u88c5<br \/>\n    public String getConfigWithFallback(String key, String defaultValue) {<br \/>\n        try {<br \/>\n            String value &#061; config.getProperty(key, defaultValue);<br \/>\n            if (value &#061;&#061; null) {<br \/>\n                \/\/ \u964d\u7ea7\u7b56\u7565&#xff1a;\u672c\u5730\u7f13\u5b58 -&gt; \u9ed8\u8ba4\u503c<br \/>\n                value &#061; getLocalCache(key, defaultValue);<br \/>\n            }<br \/>\n            return value;<br \/>\n        } catch (Exception e) {<br \/>\n            \/\/ \u5f02\u5e38\u964d\u7ea7<br \/>\n            log.warn(&#034;\u83b7\u53d6\u914d\u7f6e\u5931\u8d25&#xff0c;\u4f7f\u7528\u964d\u7ea7\u503c key: {}&#034;, key, e);<br \/>\n            return defaultValue;<br \/>\n        }<br \/>\n    }<br \/>\n} <\/p>\n<p>\u4ee3\u7801\u6e05\u53559&#xff1a;Apollo\u5ba2\u6237\u7aef\u6700\u4f73\u5b9e\u8df5<\/p>\n<h3 id=\"6.%20%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96%E5%AE%9E%E6%88%98\">6. \u6027\u80fd\u4f18\u5316\u5b9e\u6218<\/h3>\n<h4 id=\"6.1%20Spring%20Cloud%20Config%E6%80%A7%E8%83%BD%E8%B0%83%E4%BC%98\">6.1 Spring Cloud Config\u6027\u80fd\u8c03\u4f18<\/h4>\n<p>\u670d\u52a1\u7aef\u4f18\u5316&#xff1a;<\/p>\n<p># Config Server\u6027\u80fd\u4f18\u5316<br \/>\nserver:<br \/>\n  tomcat:<br \/>\n    max-threads: 200<br \/>\n    min-spare-threads: 20<br \/>\n    max-connections: 1000<\/p>\n<p>spring:<br \/>\n  cloud:<br \/>\n    config:<br \/>\n      server:<br \/>\n        git:<br \/>\n          timeout: 5<br \/>\n          force-pull: true<\/p>\n<p># \u7f13\u5b58\u4f18\u5316<br \/>\nmanagement:<br \/>\n  endpoints:<br \/>\n    web:<br \/>\n      exposure:<br \/>\n        include: health,info,metrics<br \/>\n  endpoint:<br \/>\n    metrics:<br \/>\n      enabled: true <\/p>\n<p>\u4ee3\u7801\u6e05\u535510&#xff1a;\u670d\u52a1\u7aef\u6027\u80fd\u4f18\u5316<\/p>\n<p>\u5ba2\u6237\u7aef\u4f18\u5316\u7b56\u7565&#xff1a;<\/p>\n<p>&#064;Configuration<br \/>\npublic class ConfigClientOptimize {<\/p>\n<p>    &#064;Bean<br \/>\n    &#064;Primary<br \/>\n    public ConfigServicePropertySourceLocator optimizedConfigLocator() {<br \/>\n        ConfigClientProperties properties &#061; new ConfigClientProperties();<\/p>\n<p>        \/\/ \u8fde\u63a5\u8d85\u65f6\u4f18\u5316<br \/>\n        properties.setRequestConnectTimeout(1000);<br \/>\n        properties.setRequestReadTimeout(3000);<\/p>\n<p>        \/\/ \u91cd\u8bd5\u7b56\u7565\u4f18\u5316<br \/>\n        properties.setFailFast(true);<br \/>\n        properties.setRetryInitialInterval(1000);<br \/>\n        properties.setRetryMultiplier(1.5);<br \/>\n        properties.setRetryMaxInterval(5000);<br \/>\n        properties.setRetryMaxAttempts(5);<\/p>\n<p>        return new ConfigServicePropertySourceLocator(properties);<br \/>\n    }<br \/>\n} <\/p>\n<p>\u4ee3\u7801\u6e05\u535511&#xff1a;\u5ba2\u6237\u7aef\u8fde\u63a5\u4f18\u5316<\/p>\n<h4 id=\"6.2%20Apollo%E6%80%A7%E8%83%BD%E8%B0%83%E4%BC%98\">6.2 Apollo\u6027\u80fd\u8c03\u4f18<\/h4>\n<p>\u670d\u52a1\u7aef\u6027\u80fd\u4f18\u5316&#xff1a;<\/p>\n<p># Apollo\u670d\u52a1\u7aefJVM\u4f18\u5316<br \/>\n-server<br \/>\n-Xms4g<br \/>\n-Xmx4g<br \/>\n-XX:MetaspaceSize&#061;256m<br \/>\n-XX:MaxMetaspaceSize&#061;512m<br \/>\n-XX:&#043;UseG1GC<br \/>\n-XX:MaxGCPauseMillis&#061;200<\/p>\n<p># \u6570\u636e\u5e93\u8fde\u63a5\u6c60\u4f18\u5316<br \/>\nspring.datasource.hikari.maximum-pool-size&#061;20<br \/>\nspring.datasource.hikari.minimum-idle&#061;5<br \/>\nspring.datasource.hikari.connection-timeout&#061;30000 <\/p>\n<p>\u4ee3\u7801\u6e05\u535512&#xff1a;Apollo\u670d\u52a1\u7aef\u4f18\u5316<\/p>\n<p>\u5ba2\u6237\u7aef\u6027\u80fd\u4f18\u5316&#xff1a;<\/p>\n<p>&#064;Component<br \/>\npublic class ApolloClientOptimize {<\/p>\n<p>    \/\/ \u672c\u5730\u7f13\u5b58\u4f18\u5316<br \/>\n    &#064;PostConstruct<br \/>\n    public void initLocalCache() {<br \/>\n        \/\/ \u9884\u70ed\u672c\u5730\u7f13\u5b58<br \/>\n        warmUpConfigCache();<br \/>\n    }<\/p>\n<p>    \/\/ \u6279\u91cf\u914d\u7f6e\u83b7\u53d6<br \/>\n    public Map&lt;String, String&gt; getBatchConfigs(List&lt;String&gt; keys) {<br \/>\n        return keys.stream()<br \/>\n            .collect(Collectors.toMap(<br \/>\n                key -&gt; key,<br \/>\n                key -&gt; config.getProperty(key, &#034;&#034;)<br \/>\n            ));<br \/>\n    }<\/p>\n<p>    \/\/ \u914d\u7f6e\u76d1\u542c\u53bb\u91cd<br \/>\n    private final AtomicBoolean refreshing &#061; new AtomicBoolean(false);<\/p>\n<p>    &#064;ApolloConfigChangeListener<br \/>\n    public void onOptimizedChange(ConfigChangeEvent event) {<br \/>\n        if (refreshing.compareAndSet(false, true)) {<br \/>\n            try {<br \/>\n                \/\/ \u9632\u6296\u5904\u7406<br \/>\n                Thread.sleep(100);<br \/>\n                handleConfigChange(event);<br \/>\n            } finally {<br \/>\n                refreshing.set(false);<br \/>\n            }<br \/>\n        }<br \/>\n    }<br \/>\n} <\/p>\n<p>\u4ee3\u7801\u6e05\u535513&#xff1a;Apollo\u5ba2\u6237\u7aef\u4f18\u5316<\/p>\n<h3 id=\"7.%20%E6%95%85%E9%9A%9C%E6%8E%92%E6%9F%A5%E4%B8%8E%E7%81%BE%E9%9A%BE%E6%81%A2%E5%A4%8D\">7. \u6545\u969c\u6392\u67e5\u4e0e\u707e\u96be\u6062\u590d<\/h3>\n<h4 id=\"7.1%20%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88\">7.1 \u5e38\u89c1\u95ee\u9898\u89e3\u51b3\u65b9\u6848<\/h4>\n<p>Spring Cloud Config\u5178\u578b\u6545\u969c&#xff1a;<\/p>\n<p># 1. \u914d\u7f6e\u65e0\u6cd5\u5237\u65b0<br \/>\ncurl -X POST http:\/\/config-client:8080\/actuator\/refresh<\/p>\n<p># 2. \u68c0\u67e5Git\u8fde\u63a5\u72b6\u6001<br \/>\ntelnet git.company.com 22<\/p>\n<p># 3. \u9a8c\u8bc1\u6d88\u606f\u961f\u5217\u8fde\u901a\u6027<br \/>\nrabbitmqctl list_connections<\/p>\n<p># 4. \u67e5\u770b\u914d\u7f6e\u670d\u52a1\u5668\u72b6\u6001<br \/>\ncurl http:\/\/config-server:8888\/actuator\/health <\/p>\n<p>\u4ee3\u7801\u6e05\u535514&#xff1a;Spring Cloud Config\u6545\u969c\u6392\u67e5<\/p>\n<p>Apollo\u5178\u578b\u6545\u969c\u6392\u67e5&#xff1a;<\/p>\n<p>&#064;Component<br \/>\npublic class ApolloDiagnostic {<\/p>\n<p>    \/\/ Apollo\u5065\u5eb7\u68c0\u67e5<br \/>\n    &#064;GetMapping(&#034;\/apollo\/health&#034;)<br \/>\n    public ResponseEntity&lt;Map&lt;String, Object&gt;&gt; healthCheck() {<br \/>\n        Map&lt;String, Object&gt; healthInfo &#061; new HashMap&lt;&gt;();<\/p>\n<p>        try {<br \/>\n            \/\/ 1. \u68c0\u67e5\u914d\u7f6e\u670d\u52a1\u8fde\u901a\u6027<br \/>\n            healthInfo.put(&#034;configService&#034;, checkConfigService());<\/p>\n<p>            \/\/ 2. \u68c0\u67e5\u672c\u5730\u7f13\u5b58\u72b6\u6001<br \/>\n            healthInfo.put(&#034;localCache&#034;, checkLocalCache());<\/p>\n<p>            \/\/ 3. \u68c0\u67e5\u957f\u8fde\u63a5\u72b6\u6001<br \/>\n            healthInfo.put(&#034;longPolling&#034;, checkLongPolling());<\/p>\n<p>            return ResponseEntity.ok(healthInfo);<br \/>\n        } catch (Exception e) {<br \/>\n            healthInfo.put(&#034;error&#034;, e.getMessage());<br \/>\n            return ResponseEntity.status(503).body(healthInfo);<br \/>\n        }<br \/>\n    }<\/p>\n<p>    private boolean checkConfigService() {<br \/>\n        \/\/ \u5b9e\u73b0\u914d\u7f6e\u670d\u52a1\u5065\u5eb7\u68c0\u67e5<br \/>\n        return true;<br \/>\n    }<br \/>\n} <\/p>\n<p>\u4ee3\u7801\u6e05\u535515&#xff1a;Apollo\u5065\u5eb7\u68c0\u67e5<\/p>\n<h4 id=\"7.2%20%E7%81%BE%E9%9A%BE%E6%81%A2%E5%A4%8D%E6%96%B9%E6%A1%88\">7.2 \u707e\u96be\u6062\u590d\u65b9\u6848<\/h4>\n<p>\u6570\u636e\u5907\u4efd\u7b56\u7565&#xff1a;<\/p>\n<p>&#8212; Apollo\u6570\u636e\u5e93\u5907\u4efd\u7b56\u7565<br \/>\n&#8212; 1. \u5b9a\u671f\u5168\u91cf\u5907\u4efd<br \/>\nmysqldump -u root -p apolloconfigdb &gt; apollo_backup_$(date &#043;%Y%m%d).sql<\/p>\n<p>&#8212; 2. \u5173\u952e\u8868\u5907\u4efd<br \/>\n&#8212; ApolloConfigDB \u91cd\u8981\u6570\u636e\u8868&#xff1a;<br \/>\n&#8212; App: \u5e94\u7528\u4fe1\u606f<br \/>\n&#8212; Cluster: \u96c6\u7fa4\u4fe1\u606f<br \/>\n&#8212; Namespace: \u547d\u540d\u7a7a\u95f4<br \/>\n&#8212; Item: \u914d\u7f6e\u9879<br \/>\n&#8212; Release: \u53d1\u5e03\u4fe1\u606f <\/p>\n<p>\u4ee3\u7801\u6e05\u535516&#xff1a;\u6570\u636e\u5e93\u5907\u4efd\u7b56\u7565<\/p>\n<p>\u6062\u590d\u6d41\u7a0b\u8bbe\u8ba1&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1387\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204234132-6983d92cf3484.png\" width=\"1248\" \/><\/p>\n<p>\u56fe5&#xff1a;\u707e\u96be\u6062\u590d\u6d41\u7a0b<\/p>\n<h3 id=\"8.%20%E6%8A%80%E6%9C%AF%E9%80%89%E5%9E%8B%E6%8C%87%E5%8D%97\">8. \u6280\u672f\u9009\u578b\u6307\u5357<\/h3>\n<h4 id=\"8.1%20%E9%80%89%E5%9E%8B%E5%86%B3%E7%AD%96%E7%9F%A9%E9%98%B5\">8.1 \u9009\u578b\u51b3\u7b56\u77e9\u9635<\/h4>\n<p>\u57fa\u4e8e\u4f01\u4e1a\u5b9e\u9645\u9700\u6c42\u7684\u9009\u578b\u5efa\u8bae&#xff1a;<\/p>\n<p>\u6280\u672f\u56e2\u961f\u80fd\u529b\u7ef4\u5ea6&#xff1a;<\/p>\n<table>\n<tr>\n<p>\u56e2\u961f\u7279\u70b9<\/p>\n<p>\u63a8\u8350\u65b9\u6848<\/p>\n<p>\u7406\u7531<\/p>\n<\/tr>\n<tbody>\n<tr>\n<td>\n<p>\u5f3aSpring\u80cc\u666f<\/p>\n<\/td>\n<td>\n<p>Spring Cloud Config<\/p>\n<\/td>\n<td>\n<p>\u751f\u6001\u96c6\u6210\u5ea6\u9ad8&#xff0c;\u5b66\u4e60\u6210\u672c\u4f4e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u9700\u8981\u4f01\u4e1a\u7ea7\u7ba1\u63a7<\/p>\n<\/td>\n<td>\n<p>Apollo\u200b<\/p>\n<\/td>\n<td>\n<p>\u529f\u80fd\u5b8c\u5584&#xff0c;\u7ba1\u63a7\u80fd\u529b\u5f3a<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u591a\u8bed\u8a00\u6280\u672f\u6808<\/p>\n<\/td>\n<td>\n<p>Apollo\u200b<\/p>\n<\/td>\n<td>\n<p>\u591a\u8bed\u8a00\u652f\u6301\u66f4\u597d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u5c0f\u56e2\u961f\u5feb\u901f\u542f\u52a8<\/p>\n<\/td>\n<td>\n<p>Spring Cloud Config<\/p>\n<\/td>\n<td>\n<p>\u90e8\u7f72\u7b80\u5355&#xff0c;\u4e0eSpring Boot\u65e0\u7f1d\u96c6\u6210<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e1a\u52a1\u573a\u666f\u7ef4\u5ea6&#xff1a;<\/p>\n<table>\n<tr>\n<p>\u4e1a\u52a1\u9700\u6c42<\/p>\n<p>\u63a8\u8350\u65b9\u6848<\/p>\n<p>\u5173\u952e\u8003\u91cf<\/p>\n<\/tr>\n<tbody>\n<tr>\n<td>\n<p>\u9ad8\u9891\u914d\u7f6e\u53d8\u66f4<\/p>\n<\/td>\n<td>\n<p>Apollo\u200b<\/p>\n<\/td>\n<td>\n<p>\u5b9e\u65f6\u6027\u8981\u6c42\u9ad8<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u4e25\u683c\u6743\u9650\u63a7\u5236<\/p>\n<\/td>\n<td>\n<p>Apollo\u200b<\/p>\n<\/td>\n<td>\n<p>\u5ba1\u8ba1\u548c\u6743\u9650\u7ba1\u7406\u5b8c\u5584<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u7070\u5ea6\u53d1\u5e03\u9700\u6c42<\/p>\n<\/td>\n<td>\n<p>Apollo\u200b<\/p>\n<\/td>\n<td>\n<p>\u539f\u751f\u7070\u5ea6\u652f\u6301<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u7b80\u5355\u914d\u7f6e\u7ba1\u7406<\/p>\n<\/td>\n<td>\n<p>Spring Cloud Config<\/p>\n<\/td>\n<td>\n<p>\u8f7b\u91cf\u7ea7\u65b9\u6848<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4 id=\"8.2%20%E8%BF%81%E7%A7%BB%E7%AD%96%E7%95%A5%E6%8C%87%E5%8D%97\">8.2 \u8fc1\u79fb\u7b56\u7565\u6307\u5357<\/h4>\n<p>\u4eceSpring Cloud Config\u8fc1\u79fb\u5230Apollo&#xff1a;<\/p>\n<p>\/\/ 1. \u517c\u5bb9\u5c42\u8bbe\u8ba1 &#8211; \u53cc\u914d\u7f6e\u6e90\u652f\u6301<br \/>\n&#064;Component<br \/>\npublic class DualConfigSource {<\/p>\n<p>    &#064;Primary<br \/>\n    &#064;Bean<br \/>\n    public ApolloConfigSource apolloConfigSource() {<br \/>\n        return new ApolloConfigSource();<br \/>\n    }<\/p>\n<p>    &#064;Bean<br \/>\n    public LegacyConfigSource legacyConfigSource() {<br \/>\n        return new LegacyConfigSource();<br \/>\n    }<br \/>\n}<\/p>\n<p>\/\/ 2. \u914d\u7f6e\u9879\u6620\u5c04<br \/>\n&#064;Component<br \/>\npublic class ConfigMigration {<\/p>\n<p>    public void migrateConfigs() {<br \/>\n        \/\/ \u4eceGit\u914d\u7f6e\u8fc1\u79fb\u5230Apollo<br \/>\n        Map&lt;String, String&gt; gitConfigs &#061; loadGitConfigs();<\/p>\n<p>        for (Map.Entry&lt;String, String&gt; entry : gitConfigs.entrySet()) {<br \/>\n            migrateConfigItem(entry.getKey(), entry.getValue());<br \/>\n        }<br \/>\n    }<\/p>\n<p>    private void migrateConfigItem(String key, String value) {<br \/>\n        \/\/ \u5b9e\u73b0\u914d\u7f6e\u9879\u8fc1\u79fb\u903b\u8f91<br \/>\n        \/\/ \u6ce8\u610f&#xff1a;\u654f\u611f\u914d\u7f6e\u9700\u8981\u52a0\u5bc6\u5904\u7406<br \/>\n    }<br \/>\n} <\/p>\n<p>\u4ee3\u7801\u6e05\u535517&#xff1a;\u8fc1\u79fb\u7b56\u7565\u5b9e\u73b0<\/p>\n<h3 id=\"9.%20%E6%9C%AA%E6%9D%A5%E5%8F%91%E5%B1%95%E8%B6%8B%E5%8A%BF\">9. \u672a\u6765\u53d1\u5c55\u8d8b\u52bf<\/h3>\n<h4 id=\"9.1%20%E9%85%8D%E7%BD%AE%E4%B8%AD%E5%BF%83%E6%8A%80%E6%9C%AF%E6%BC%94%E8%BF%9B\">9.1 \u914d\u7f6e\u4e2d\u5fc3\u6280\u672f\u6f14\u8fdb<\/h4>\n<p>\u4e91\u539f\u751f\u8d8b\u52bf&#xff1a;<\/p>\n<p># Kubernetes\u539f\u751f\u914d\u7f6e\u7ba1\u7406<br \/>\napiVersion: v1<br \/>\nkind: ConfigMap<br \/>\nmetadata:<br \/>\n  name: app-config<br \/>\ndata:<br \/>\n  application.properties: |<br \/>\n    app.name&#061;user-service<br \/>\n    app.version&#061;1.0.0<\/p>\n<p># \u914d\u7f6e\u5373\u4ee3\u7801&#xff08;Configuration as Code&#xff09;<br \/>\napiVersion: apollo.v1<br \/>\nkind: AppConfig<br \/>\nspec:<br \/>\n  appId: user-service<br \/>\n  clusters:<br \/>\n    &#8211; name: default<br \/>\n      namespaces:<br \/>\n        &#8211; name: application<br \/>\n          configs:<br \/>\n            &#8211; key: server.port<br \/>\n              value: &#034;8080&#034;<br \/>\n            &#8211; key: spring.datasource.url<br \/>\n              value: &#034;${DB_URL}&#034; <\/p>\n<p>\u4ee3\u7801\u6e05\u535518&#xff1a;\u4e91\u539f\u751f\u914d\u7f6e\u7ba1\u7406<\/p>\n<p>\u667a\u80fd\u5316\u65b9\u5411&#xff1a;<\/p>\n<ul>\n<li>\n<p>AI\u9a71\u52a8\u7684\u914d\u7f6e\u4f18\u5316&#xff1a;\u57fa\u4e8e\u5386\u53f2\u6570\u636e\u81ea\u52a8\u63a8\u8350\u6700\u4f18\u914d\u7f6e<\/p>\n<\/li>\n<li>\n<p>\u914d\u7f6e\u5b89\u5168\u5206\u6790&#xff1a;\u81ea\u52a8\u68c0\u6d4b\u914d\u7f6e\u4e2d\u7684\u5b89\u5168\u98ce\u9669<\/p>\n<\/li>\n<li>\n<p>\u81ea\u9002\u5e94\u914d\u7f6e\u63a8\u9001&#xff1a;\u6839\u636e\u7f51\u7edc\u72b6\u51b5\u81ea\u52a8\u9009\u62e9\u63a8\u9001\u7b56\u7565<\/p>\n<\/li>\n<\/ul>\n<h3 id=\"%F0%9F%93%9A%20%E5%AE%98%E6%96%B9%E6%96%87%E6%A1%A3%E4%B8%8E%E5%8F%82%E8%80%83\">&#x1f4da; \u5b98\u65b9\u6587\u6863\u4e0e\u53c2\u8003<\/h3>\n<h4 id=\"%E6%A0%B8%E5%BF%83%E6%96%87%E6%A1%A3\">\u6838\u5fc3\u6587\u6863<\/h4>\n<li>\n<p>Spring Cloud Config\u5b98\u65b9\u6587\u6863- \u5b98\u65b9\u6743\u5a01\u6307\u5357<\/p>\n<\/li>\n<li>\n<p>Apollo GitHub\u4ed3\u5e93- \u643a\u7a0b\u5f00\u6e90\u914d\u7f6e\u4e2d\u5fc3<\/p>\n<\/li>\n<li>\n<p>Nacos\u5b98\u65b9\u6587\u6863- \u963f\u91cc\u5f00\u6e90\u914d\u7f6e\u4e2d\u5fc3<\/p>\n<\/li>\n<h4 id=\"%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5\">\u6700\u4f73\u5b9e\u8df5<\/h4>\n<li>\n<p>\u5fae\u670d\u52a1\u914d\u7f6e\u7ba1\u740612\u8981\u7d20- \u914d\u7f6e\u7ba1\u7406\u539f\u5219<\/p>\n<\/li>\n<li>\n<p>\u914d\u7f6e\u4e2d\u5fc3\u8bbe\u8ba1\u6a21\u5f0f- \u67b6\u6784\u8bbe\u8ba1\u6307\u5357<\/p>\n<\/li>\n<h4 id=\"%E7%A4%BE%E5%8C%BA%E8%B5%84%E6%BA%90\">\u793e\u533a\u8d44\u6e90<\/h4>\n<li>\n<p>Spring Cloud\u4e2d\u56fd\u793e\u533a- \u4e2d\u6587\u6280\u672f\u4ea4\u6d41<\/p>\n<\/li>\n<li>\n<p>Apollo\u7528\u6237\u6848\u4f8b- \u4f01\u4e1a\u5b9e\u8df5\u5206\u4eab<\/p>\n<\/li>\n<hr \/>\n<p>\u603b\u7ed3\u5efa\u8bae&#xff1a;\u9009\u62e9\u914d\u7f6e\u4e2d\u5fc3\u8981\u57fa\u4e8e\u56e2\u961f\u6280\u672f\u6808\u548c\u4e1a\u52a1\u9700\u6c42\u3002Spring Cloud Config\u9002\u5408Spring\u6280\u672f\u6808\u7684\u56e2\u961f&#xff0c;Apollo\u9002\u5408\u9700\u8981\u4f01\u4e1a\u7ea7\u7ba1\u63a7\u7684\u573a\u666f\u3002\u8bb0\u4f4f&#xff1a;\u6ca1\u6709\u6700\u597d\u7684\u65b9\u6848&#xff0c;\u53ea\u6709\u6700\u9002\u5408\u7684\u65b9\u6848\u3002<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u4e3a\u6709\u591a\u5e74Java\u7ecf\u9a8c\u7684\u5f00\u53d1\u8005&#xff0c;\u6211\u89c1\u8bc1\u4e86\u914d\u7f6e\u7ba1\u7406\u4ece\u786c\u7f16\u7801\u5230\u914d\u7f6e\u4e2d\u5fc3\u7684\u6f14\u8fdb\u5386\u7a0b\u3002\u8bb0\u5f97\u66fe\u6709\u4e2a\u9879\u76ee&#xff0c;\u56e0\u4e3a\u4e00\u4e2a\u6570\u636e\u5e93\u914d\u7f6e\u9519\u8bef&#xff0c;\u5bfc\u81f4\u751f\u4ea7\u73af\u5883\u762b\u75ea2\u5c0f\u65f6\u2014\u2014\u6ca1\u6709\u9760\u8c31\u7684\u914d\u7f6e\u4e2d\u5fc3&#xff0c;\u5c31\u662f\u5728\u60ac\u5d16\u8fb9\u8df3\u821e\u3002 \u76ee\u5f55<br \/>\n\u2728 \u6458\u8981<br \/>\n1. \u914d\u7f6e\u4e2d\u5fc3&#xff1a;\u5fae\u670d\u52a1\u7684\\&#8221;\u795e\u7ecf\u4e2d\u67a2\\&#8221;<br \/>\n1.1 \u4e3a\u4ec0\u4e48\u4f20\u7edf\u914d\u7f6e\u7ba1\u7406\u4f1a\u8981\u547d&#xff1f;<br \/>\n1.2 \u914d\u7f6e\u4e2d\u5fc3\u7684\u6838\u5fc3\u4ef7\u503c<br \/>\n2. Spring Cloud Config\u67b6\u6784\u6df1\u5ea6\u89e3\u6790<br \/>\n2.1 \u6838\u5fc3\u67b6\u6784\u8bbe\u8ba1 <\/p>\n","protected":false},"author":2,"featured_media":72223,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7596,7345,645,664,188],"topic":[],"class_list":["post-72228","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-apollo","tag-7345","tag-springcloud","tag-664","tag-188"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5206\u5e03\u5f0f\u914d\u7f6e\u4e2d\u5fc3\u7ec8\u6781\u5bf9\u51b3 Spring Cloud Config\u4e0eApollo\u67b6\u6784\u6df1\u5ea6\u89e3\u6790 - \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\/72228.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5206\u5e03\u5f0f\u914d\u7f6e\u4e2d\u5fc3\u7ec8\u6781\u5bf9\u51b3 Spring Cloud Config\u4e0eApollo\u67b6\u6784\u6df1\u5ea6\u89e3\u6790 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4f5c\u4e3a\u6709\u591a\u5e74Java\u7ecf\u9a8c\u7684\u5f00\u53d1\u8005&#xff0c;\u6211\u89c1\u8bc1\u4e86\u914d\u7f6e\u7ba1\u7406\u4ece\u786c\u7f16\u7801\u5230\u914d\u7f6e\u4e2d\u5fc3\u7684\u6f14\u8fdb\u5386\u7a0b\u3002\u8bb0\u5f97\u66fe\u6709\u4e2a\u9879\u76ee&#xff0c;\u56e0\u4e3a\u4e00\u4e2a\u6570\u636e\u5e93\u914d\u7f6e\u9519\u8bef&#xff0c;\u5bfc\u81f4\u751f\u4ea7\u73af\u5883\u762b\u75ea2\u5c0f\u65f6\u2014\u2014\u6ca1\u6709\u9760\u8c31\u7684\u914d\u7f6e\u4e2d\u5fc3&#xff0c;\u5c31\u662f\u5728\u60ac\u5d16\u8fb9\u8df3\u821e\u3002 \u76ee\u5f55 \u2728 \u6458\u8981 1. \u914d\u7f6e\u4e2d\u5fc3&#xff1a;\u5fae\u670d\u52a1\u7684&quot;\u795e\u7ecf\u4e2d\u67a2&quot; 1.1 \u4e3a\u4ec0\u4e48\u4f20\u7edf\u914d\u7f6e\u7ba1\u7406\u4f1a\u8981\u547d&#xff1f; 1.2 \u914d\u7f6e\u4e2d\u5fc3\u7684\u6838\u5fc3\u4ef7\u503c 2. Spring Cloud Config\u67b6\u6784\u6df1\u5ea6\u89e3\u6790 2.1 \u6838\u5fc3\u67b6\u6784\u8bbe\u8ba1\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/72228.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-04T23:41:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204234130-6983d92a85917.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=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/72228.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/72228.html\",\"name\":\"\u5206\u5e03\u5f0f\u914d\u7f6e\u4e2d\u5fc3\u7ec8\u6781\u5bf9\u51b3 Spring Cloud Config\u4e0eApollo\u67b6\u6784\u6df1\u5ea6\u89e3\u6790 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-04T23:41:34+00:00\",\"dateModified\":\"2026-02-04T23:41:34+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/72228.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/72228.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/72228.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5206\u5e03\u5f0f\u914d\u7f6e\u4e2d\u5fc3\u7ec8\u6781\u5bf9\u51b3 Spring Cloud Config\u4e0eApollo\u67b6\u6784\u6df1\u5ea6\u89e3\u6790\"}]},{\"@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":"\u5206\u5e03\u5f0f\u914d\u7f6e\u4e2d\u5fc3\u7ec8\u6781\u5bf9\u51b3 Spring Cloud Config\u4e0eApollo\u67b6\u6784\u6df1\u5ea6\u89e3\u6790 - \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\/72228.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5206\u5e03\u5f0f\u914d\u7f6e\u4e2d\u5fc3\u7ec8\u6781\u5bf9\u51b3 Spring Cloud Config\u4e0eApollo\u67b6\u6784\u6df1\u5ea6\u89e3\u6790 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4f5c\u4e3a\u6709\u591a\u5e74Java\u7ecf\u9a8c\u7684\u5f00\u53d1\u8005&#xff0c;\u6211\u89c1\u8bc1\u4e86\u914d\u7f6e\u7ba1\u7406\u4ece\u786c\u7f16\u7801\u5230\u914d\u7f6e\u4e2d\u5fc3\u7684\u6f14\u8fdb\u5386\u7a0b\u3002\u8bb0\u5f97\u66fe\u6709\u4e2a\u9879\u76ee&#xff0c;\u56e0\u4e3a\u4e00\u4e2a\u6570\u636e\u5e93\u914d\u7f6e\u9519\u8bef&#xff0c;\u5bfc\u81f4\u751f\u4ea7\u73af\u5883\u762b\u75ea2\u5c0f\u65f6\u2014\u2014\u6ca1\u6709\u9760\u8c31\u7684\u914d\u7f6e\u4e2d\u5fc3&#xff0c;\u5c31\u662f\u5728\u60ac\u5d16\u8fb9\u8df3\u821e\u3002 \u76ee\u5f55 \u2728 \u6458\u8981 1. \u914d\u7f6e\u4e2d\u5fc3&#xff1a;\u5fae\u670d\u52a1\u7684\"\u795e\u7ecf\u4e2d\u67a2\" 1.1 \u4e3a\u4ec0\u4e48\u4f20\u7edf\u914d\u7f6e\u7ba1\u7406\u4f1a\u8981\u547d&#xff1f; 1.2 \u914d\u7f6e\u4e2d\u5fc3\u7684\u6838\u5fc3\u4ef7\u503c 2. Spring Cloud Config\u67b6\u6784\u6df1\u5ea6\u89e3\u6790 2.1 \u6838\u5fc3\u67b6\u6784\u8bbe\u8ba1","og_url":"https:\/\/www.wsisp.com\/helps\/72228.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-04T23:41:34+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204234130-6983d92a85917.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/72228.html","url":"https:\/\/www.wsisp.com\/helps\/72228.html","name":"\u5206\u5e03\u5f0f\u914d\u7f6e\u4e2d\u5fc3\u7ec8\u6781\u5bf9\u51b3 Spring Cloud Config\u4e0eApollo\u67b6\u6784\u6df1\u5ea6\u89e3\u6790 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-04T23:41:34+00:00","dateModified":"2026-02-04T23:41:34+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/72228.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/72228.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/72228.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5206\u5e03\u5f0f\u914d\u7f6e\u4e2d\u5fc3\u7ec8\u6781\u5bf9\u51b3 Spring Cloud Config\u4e0eApollo\u67b6\u6784\u6df1\u5ea6\u89e3\u6790"}]},{"@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\/72228","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=72228"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/72228\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/72223"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=72228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=72228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=72228"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=72228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}