{"id":5158,"date":"2024-08-01T22:47:45","date_gmt":"2024-08-01T14:47:45","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=5158"},"modified":"2024-08-01T22:47:45","modified_gmt":"2024-08-01T14:47:45","slug":"springboot%e4%b8%ad%e8%bf%995%e7%a7%8d%e9%ab%98%e5%a4%a7%e4%b8%8a%e7%9a%84yml%e6%96%87%e4%bb%b6%e8%af%bb%e5%8f%96%e6%96%b9%e5%bc%8f%ef%bc%8c%e4%bd%a0%e7%9f%a5%e9%81%93%e5%90%97%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/spring-boot\/springboot%e4%b8%ad%e8%bf%995%e7%a7%8d%e9%ab%98%e5%a4%a7%e4%b8%8a%e7%9a%84yml%e6%96%87%e4%bb%b6%e8%af%bb%e5%8f%96%e6%96%b9%e5%bc%8f%ef%bc%8c%e4%bd%a0%e7%9f%a5%e9%81%93%e5%90%97%ef%bc%9f\/","title":{"rendered":"SpringBoot\u4e2d\u8fd95\u79cd\u9ad8\u5927\u4e0a\u7684yml\u6587\u4ef6\u8bfb\u53d6\u65b9\u5f0f\uff0c\u4f60\u77e5\u9053\u5417\uff1f"},"content":{"rendered":"<div class='wxsyncmain'>\n<section data-tool=\"mdnice\u7f16\u8f91\u5668\" data-website=\"https:\/\/www.mdnice.com\" style=\"padding-right: 10px;padding-left: 10px;text-align: left;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;line-height: 1.6;letter-spacing: 0.034em;color: rgb(63, 63, 63);font-size: 16px;\">\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-imgfileid=\"100041821\" data-ratio=\"0.65\"  data-type=\"png\" data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;border-radius: 4px;margin-bottom: 25px;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215720580.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-imgfileid=\"100041821\" data-ratio=\"0.65\"  data-type=\"png\" data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;border-radius: 4px;margin-bottom: 25px;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215720580.png\"  \/><\/noscript><\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;text-align: right;\">mall\u5b66\u4e60\u6559\u7a0b\u5b98\u7f51\uff1a<span style=\"color: rgb(57, 179, 122);\"><strong>macrozheng.com<\/strong><\/span><\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u5728<a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzU1Nzg4NjgyMw==&amp;mid=2247497268&amp;idx=2&amp;sn=b8e7b31601c32180387c0ce30f81c524&amp;scene=21#wechat_redirect\" style=\"font-weight: bold;color: rgb(72, 179, 120);border-bottom: 1px solid rgb(72, 179, 120);\" data-linktype=\"2\" target=\"_blank\"  rel=\"nofollow\" >\u4e0a\u4e00\u7bc7\u6587\u7ae0<\/a>\u4e2d\uff0c\u6211\u4eec\u4ece\u6e90\u7801\u89d2\u5ea6\u5206\u6790\u4e86SpringBoot\u89e3\u6790yml\u914d\u7f6e\u6587\u4ef6\u7684\u5168\u6d41\u7a0b\uff0c\u90a3\u4e48\u6211\u4eec\u4eca\u5929\u5c31\u6765\u70b9\u5b9e\u6218\uff0c\u603b\u7ed3\u4e00\u4e0b\u9664\u4e86\u70c2\u5927\u8857\u7684<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">@Value<\/code>\u548c<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">@ConfigurationProperties<\/code>\u5916\uff0c\u8fd8\u80fd\u591f\u901a\u8fc7\u54ea\u4e9b\u65b9\u5f0f\uff0c\u6765\u8bfb\u53d6yml\u914d\u7f6e\u6587\u4ef6\u7684\u5185\u5bb9\u3002<\/p>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;color: black;font-size: 22px;text-align: center;background-image: url('https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215710941.png');background-position: center center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 50px;margin-top: 1em;margin-bottom: 10px;\"><span style=\"display: none;\"><\/span><span style=\"display: inline-block;height: 38px;line-height: 42px;color: rgb(72, 179, 120);background-position: left center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 63px;margin-top: 38px;font-size: 18px;margin-bottom: 10px;\">1\u3001Environment<\/span><\/h2>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u5728Spring\u4e2d\u6709\u4e00\u4e2a\u7c7b<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">Environment<\/code>\uff0c\u5b83\u53ef\u4ee5\u88ab\u8ba4\u4e3a\u662f\u5f53\u524d\u5e94\u7528\u7a0b\u5e8f\u6b63\u5728\u8fd0\u884c\u7684\u73af\u5883\uff0c\u5b83\u7ee7\u627f\u4e86<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">PropertyResolver<\/code>\u63a5\u53e3\uff0c\u56e0\u6b64\u53ef\u4ee5\u4f5c\u4e3a\u4e00\u4e2a\u5c5e\u6027\u89e3\u6790\u5668\u4f7f\u7528\u3002\u5148\u521b\u5efa\u4e00\u4e2ayml\u6587\u4ef6\uff0c\u5c5e\u6027\u5982\u4e0b\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"color: #d19a66;line-height: 26px;\">person:<\/span><span style=\"color: #d19a66;line-height: 26px;\">name:<\/span><span style=\"color: #98c379;line-height: 26px;\">hydra<\/span><span style=\"color: #d19a66;line-height: 26px;\">gender:<\/span><span style=\"color: #98c379;line-height: 26px;\">male<\/span><span style=\"color: #d19a66;line-height: 26px;\">age:<\/span><span style=\"color: #d19a66;line-height: 26px;\">18<\/span><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u4f7f\u7528\u8d77\u6765\u4e5f\u975e\u5e38\u7b80\u5355\uff0c\u76f4\u63a5\u4f7f\u7528<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">@Autowired<\/code>\u5c31\u53ef\u4ee5\u6ce8\u5165\u5230\u8981\u4f7f\u7528\u7684\u7c7b\u4e2d\uff0c\u7136\u540e\u8c03\u7528\u5b83\u7684<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">getProperty()<\/code>\u65b9\u6cd5\u5c31\u53ef\u4ee5\u6839\u636e\u5c5e\u6027\u540d\u79f0\u53d6\u51fa\u5bf9\u5e94\u7684\u503c\u4e86\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"color: #61aeee;line-height: 26px;\">@RestController<\/span><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span><span style=\"color: #e6c07b;line-height: 26px;\">EnvironmentController<\/span><\/span>{<span style=\"color: #61aeee;line-height: 26px;\">@Autowired<\/span><span style=\"color: #c678dd;line-height: 26px;\">private<\/span>Environmentenvironment;<span style=\"color: #61aeee;line-height: 26px;\">@GetMapping<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"envTest\"<\/span>)<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">private<\/span><span style=\"color: #c678dd;line-height: 26px;\">void<\/span><span style=\"color: #61aeee;line-height: 26px;\">getEnv<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{System.out.println(environment.getProperty(<span style=\"color: #98c379;line-height: 26px;\">\"person.name\"<\/span>));System.out.println(environment.getProperty(<span style=\"color: #98c379;line-height: 26px;\">\"person.gender\"<\/span>));IntegerautoClose=environment.getProperty(<span style=\"color: #98c379;line-height: 26px;\">\"person.age\"<\/span>,Integer<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)<\/span>;System.out.println(autoClose);StringdefaultValue=environment.getProperty(<span style=\"color: #98c379;line-height: 26px;\">\"person.other\"<\/span>,String<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>,\"<span style=\"color: #e6c07b;line-height: 26px;\">defaultValue<\/span>\")<\/span>;System.out.println(defaultValue);}}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\u53ef\u4ee5\u770b\u5230\uff0c\u9664\u4e86\u7b80\u5355\u7684\u83b7\u53d6\u5916\uff0c<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">Environment<\/code>\u63d0\u4f9b\u7684\u65b9\u6cd5\u8fd8\u53ef\u4ee5\u5bf9\u53d6\u51fa\u7684\u5c5e\u6027\u503c\u8fdb\u884c\u7c7b\u578b\u8f6c\u6362\u3001\u4ee5\u53ca\u9ed8\u8ba4\u503c\u7684\u8bbe\u7f6e\uff0c\u8c03\u7528\u4e00\u4e0b\u4e0a\u9762\u7684\u63a5\u53e3\uff0c\u6253\u5370\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\">hydramale18defaultValue<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u9664\u4e86\u83b7\u53d6\u5c5e\u6027\u5916\uff0c\u8fd8\u53ef\u4ee5\u7528\u6765\u5224\u65ad\u6fc0\u6d3b\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u6211\u4eec\u5148\u5728<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">application.yml<\/code>\u4e2d\u6fc0\u6d3b<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">pro<\/code>\u6587\u4ef6\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"color: #d19a66;line-height: 26px;\">spring:<\/span><span style=\"color: #d19a66;line-height: 26px;\">profiles:<\/span><span style=\"color: #d19a66;line-height: 26px;\">active:<\/span><span style=\"color: #98c379;line-height: 26px;\">pro<\/span><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u53ef\u4ee5\u901a\u8fc7<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">acceptsProfiles<\/code>\u65b9\u6cd5\u6765\u68c0\u6d4b\u67d0\u4e00\u4e2a\u914d\u7f6e\u6587\u4ef6\u662f\u5426\u88ab\u6fc0\u6d3b\u52a0\u8f7d\uff0c\u6216\u8005\u901a\u8fc7<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">getActiveProfiles<\/code>\u65b9\u6cd5\u62ff\u5230\u6240\u6709\u88ab\u6fc0\u6d3b\u7684\u914d\u7f6e\u6587\u4ef6\u3002\u6d4b\u8bd5\u63a5\u53e3\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"color: #61aeee;line-height: 26px;\">@GetMapping<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"getActiveEnv\"<\/span>)<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">private<\/span><span style=\"color: #c678dd;line-height: 26px;\">void<\/span><span style=\"color: #61aeee;line-height: 26px;\">getActiveEnv<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{System.out.println(environment.acceptsProfiles(<span style=\"color: #98c379;line-height: 26px;\">\"pro\"<\/span>));System.out.println(environment.acceptsProfiles(<span style=\"color: #98c379;line-height: 26px;\">\"dev\"<\/span>));String[]activeProfiles=environment.getActiveProfiles();<span style=\"color: #c678dd;line-height: 26px;\">for<\/span>(StringactiveProfile:activeProfiles){System.out.println(activeProfile);}}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u6253\u5370\u7ed3\u679c\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"color: #56b6c2;line-height: 26px;\">true<\/span><span style=\"color: #56b6c2;line-height: 26px;\">false<\/span>pro<\/code><\/pre>\n<blockquote data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"border-top: none;border-right: none;border-bottom: none;font-size: 0.9em;overflow: auto;background: rgb(251, 249, 253);color: rgb(106, 115, 125);margin-bottom: 20px;margin-top: 20px;padding: 15px 20px;line-height: 27px;border-left-color: rgb(53, 179, 120);\">\n<p style=\"line-height: 26px;font-size: 15px;color: rgb(89, 89, 89);\"><span style=\"color: rgb(57, 179, 122);\"><strong>\u8fd9\u6216\u8bb8\u662f\u4e00\u4e2a\u5bf9\u4f60\u6709\u7528\u7684\u5f00\u6e90\u9879\u76ee<\/strong><\/span>\uff0cmall\u9879\u76ee\u662f\u4e00\u5957\u57fa\u4e8e <a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzU1Nzg4NjgyMw==&amp;mid=2247523575&amp;idx=1&amp;sn=3a3b527b57dc985968854839a915a5dc&amp;scene=21#wechat_redirect\" style=\"font-weight: bold;color: rgb(72, 179, 120);border-bottom: 1px solid rgb(72, 179, 120);\" data-linktype=\"2\" target=\"_blank\"  rel=\"nofollow\" >SpringBoot3<\/a> + JDK 17 + Vue \u5b9e\u73b0\u7684\u7535\u5546\u7cfb\u7edf\uff08<span style=\"color: rgb(57, 179, 122);\"><strong>Github\u6807\u661f60K<\/strong><\/span>\uff09\uff0c\u91c7\u7528Docker\u5bb9\u5668\u5316\u90e8\u7f72\uff0c\u540e\u7aef\u652f\u6301\u591a\u6a21\u5757\u548c\u5fae\u670d\u52a1\u67b6\u6784\u3002\u5305\u62ec\u524d\u53f0\u5546\u57ce\u9879\u76ee\u548c\u540e\u53f0\u7ba1\u7406\u7cfb\u7edf\uff0c\u80fd\u652f\u6301\u5b8c\u6574\u7684\u8ba2\u5355\u6d41\u7a0b\uff01\u6db5\u76d6\u5546\u54c1\u3001\u8ba2\u5355\u3001\u8d2d\u7269\u8f66\u3001\u6743\u9650\u3001\u4f18\u60e0\u5238\u3001\u4f1a\u5458\u3001\u652f\u4ed8\u7b49\u529f\u80fd\uff01<\/p>\n<ul style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">Boot\u9879\u76ee\uff1a<span style=\"color: rgb(57, 179, 122);\"><strong>https:\/\/github.com\/macrozheng\/mall<\/strong><\/span><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">Cloud\u9879\u76ee\uff1a<span style=\"color: rgb(57, 179, 122);\"><strong>https:\/\/github.com\/macrozheng\/mall-swarm<\/strong><\/span><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\u89c6\u9891\u6559\u7a0b\uff1a<span style=\"color: rgb(57, 179, 122);\"><strong>https:\/\/www.macrozheng.com\/video\/<\/strong><\/span><\/section>\n<\/li>\n<\/ul>\n<p style=\"line-height: 26px;font-size: 15px;color: rgb(89, 89, 89);\">\u9879\u76ee\u6f14\u793a\uff1a<img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-imgfileid=\"100041822\" data-ratio=\"0.5681186283595923\"  data-type=\"gif\" data-w=\"1079\" style=\"display: block;margin-right: auto;margin-left: auto;border-radius: 4px;margin-bottom: 25px;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215725553.gif\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-imgfileid=\"100041822\" data-ratio=\"0.5681186283595923\"  data-type=\"gif\" data-w=\"1079\" style=\"display: block;margin-right: auto;margin-left: auto;border-radius: 4px;margin-bottom: 25px;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215725553.gif\"  \/><\/noscript><\/p>\n<\/blockquote>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;color: black;font-size: 22px;text-align: center;background-image: url('https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215710941.png');background-position: center center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 50px;margin-top: 1em;margin-bottom: 10px;\"><span style=\"display: none;\"><\/span><span style=\"display: inline-block;height: 38px;line-height: 42px;color: rgb(72, 179, 120);background-position: left center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 63px;margin-top: 38px;font-size: 18px;margin-bottom: 10px;\">2\u3001YamlPropertiesFactoryBean<\/span><\/h2>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u5728Spring\u4e2d\u8fd8\u53ef\u4ee5\u4f7f\u7528<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">YamlPropertiesFactoryBean<\/code>\u6765\u8bfb\u53d6\u81ea\u5b9a\u4e49\u914d\u7f6e\u7684yml\u6587\u4ef6\uff0c\u800c\u4e0d\u7528\u518d\u88ab\u62d8\u675f\u4e8e<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">application.yml<\/code>\u53ca\u5176\u6fc0\u6d3b\u7684\u5176\u4ed6\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\uff0c\u53ea\u9700\u8981\u901a\u8fc7<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">setResources()<\/code>\u65b9\u6cd5\u8bbe\u7f6e\u81ea\u5b9a\u4e49yml\u914d\u7f6e\u6587\u4ef6\u7684\u5b58\u50a8\u8def\u5f84\uff0c\u518d\u901a\u8fc7<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">getObject()<\/code>\u65b9\u6cd5\u83b7\u53d6<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">Properties<\/code>\u5bf9\u8c61\uff0c\u540e\u7eed\u5c31\u53ef\u4ee5\u901a\u8fc7\u5b83\u83b7\u53d6\u5177\u4f53\u7684\u5c5e\u6027\uff0c\u4e0b\u9762\u770b\u4e00\u4e2a\u4f8b\u5b50\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"color: #61aeee;line-height: 26px;\">@GetMapping<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"fcTest\"<\/span>)<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"color: #c678dd;line-height: 26px;\">void<\/span><span style=\"color: #61aeee;line-height: 26px;\">ymlProFctest<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{YamlPropertiesFactoryBeanyamlProFb=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>YamlPropertiesFactoryBean();yamlProFb.setResources(<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>ClassPathResource(<span style=\"color: #98c379;line-height: 26px;\">\"application2.yml\"<\/span>));Propertiesproperties=yamlProFb.getObject();System.out.println(properties.get(<span style=\"color: #98c379;line-height: 26px;\">\"person2.name\"<\/span>));System.out.println(properties.get(<span style=\"color: #98c379;line-height: 26px;\">\"person2.gender\"<\/span>));System.out.println(properties.toString());}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u67e5\u770b\u8fd0\u884c\u7ed3\u679c\uff0c\u53ef\u4ee5\u8bfb\u53d6\u6307\u5b9a\u7684<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">application2.yml<\/code>\u7684\u5185\u5bb9\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\">susanfemale{person2.age=18,person2.gender=female,person2.name=susan}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u4f46\u662f\u8fd9\u6837\u7684\u4f7f\u7528\u4e2d\u6709\u4e00\u4e2a\u95ee\u9898\uff0c\u90a3\u5c31\u662f\u53ea\u6709\u5728\u8fd9\u4e2a\u63a5\u53e3\u7684\u8bf7\u6c42\u4e2d\u80fd\u591f\u53d6\u5230\u8fd9\u4e2a\u5c5e\u6027\u7684\u503c\uff0c\u5982\u679c\u518d\u5199\u4e00\u4e2a\u63a5\u53e3\uff0c\u4e0d\u4f7f\u7528<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">YamlPropertiesFactoryBean<\/code>\u8bfb\u53d6\u914d\u7f6e\u6587\u4ef6\uff0c\u5373\u4f7f\u4e4b\u524d\u7684\u65b9\u6cd5\u5df2\u7ecf\u8bfb\u53d6\u8fc7\u8fd9\u4e2ayml\u6587\u4ef6\u4e00\u6b21\u4e86\uff0c\u7b2c\u4e8c\u4e2a\u63a5\u53e3\u53d6\u5230\u7684\u4ecd\u7136\u8fd8\u662f\u7a7a\u503c\u3002\u6765\u5bf9\u8fd9\u4e2a\u8fc7\u7a0b\u8fdb\u884c\u4e00\u4e0b\u6d4b\u8bd5\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"color: #61aeee;line-height: 26px;\">@Value<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"${person2.name:null}\"<\/span>)<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>Stringname;<span style=\"color: #61aeee;line-height: 26px;\">@Value<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"${person2.gender:null}\"<\/span>)<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>Stringgender;<span style=\"color: #61aeee;line-height: 26px;\">@GetMapping<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"fcTest2\"<\/span>)<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"color: #c678dd;line-height: 26px;\">void<\/span><span style=\"color: #61aeee;line-height: 26px;\">ymlProFctest2<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{System.out.println(name);System.out.println(gender);}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u5148\u8c03\u7528\u4e00\u6b21<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">fcTest<\/code>\u63a5\u53e3\uff0c\u518d\u8c03\u7528<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">fcTest2<\/code>\u63a5\u53e3\u65f6\u4f1a\u6253\u5370<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">null<\/code>\u503c\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\">nullnull<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u60f3\u8981\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u4e5f\u5f88\u7b80\u5355\uff0c\u53ef\u4ee5\u914d\u5408<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">PropertySourcesPlaceholderConfigurer<\/code>\u4f7f\u7528\uff0c\u5b83\u5b9e\u73b0\u4e86<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">BeanFactoryPostProcessor<\/code>\u63a5\u53e3\uff0c\u4e5f\u5c31\u662f\u4e00\u4e2abean\u5de5\u5382\u540e\u7f6e\u5904\u7406\u5668\u7684\u5b9e\u73b0\uff0c\u53ef\u4ee5\u5c06\u914d\u7f6e\u6587\u4ef6\u7684\u5c5e\u6027\u503c\u52a0\u8f7d\u5230\u4e00\u4e2a<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">Properties<\/code>\u6587\u4ef6\u4e2d\u3002\u4f7f\u7528\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"color: #61aeee;line-height: 26px;\">@Configuration<\/span><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span><span style=\"color: #e6c07b;line-height: 26px;\">PropertyConfig<\/span><\/span>{<span style=\"color: #61aeee;line-height: 26px;\">@Bean<\/span><span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"color: #c678dd;line-height: 26px;\">static<\/span>PropertySourcesPlaceholderConfigurer<span style=\"color: #61aeee;line-height: 26px;\">placeholderConfigurer<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{PropertySourcesPlaceholderConfigurerconfigurer=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>PropertySourcesPlaceholderConfigurer();YamlPropertiesFactoryBeanyamlProFb=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>YamlPropertiesFactoryBean();yamlProFb.setResources(<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>ClassPathResource(<span style=\"color: #98c379;line-height: 26px;\">\"application2.yml\"<\/span>));configurer.setProperties(yamlProFb.getObject());<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>configurer;}}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u518d\u6b21\u8c03\u7528\u4e4b\u524d\u7684\u63a5\u53e3\uff0c\u7ed3\u679c\u5982\u4e0b\uff0c\u53ef\u4ee5\u6b63\u5e38\u7684\u53d6\u5230<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">application2.yml<\/code>\u4e2d\u7684\u5c5e\u6027\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\">susanfemale<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u9664\u4e86\u4f7f\u7528<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">YamlPropertiesFactoryBean<\/code>\u5c06yml\u89e3\u6790\u6210<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">Properties<\/code>\u5916\uff0c\u5176\u5b9e\u6211\u4eec\u8fd8\u53ef\u4ee5\u4f7f\u7528<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">YamlMapFactoryBean<\/code>\u89e3\u6790yml\u6210\u4e3a<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">Map<\/code>\uff0c\u4f7f\u7528\u65b9\u6cd5\u975e\u5e38\u7c7b\u4f3c\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"color: #61aeee;line-height: 26px;\">@GetMapping<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"fcMapTest\"<\/span>)<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"color: #c678dd;line-height: 26px;\">void<\/span><span style=\"color: #61aeee;line-height: 26px;\">ymlMapFctest<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{YamlMapFactoryBeanyamlMapFb=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>YamlMapFactoryBean();yamlMapFb.setResources(<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>ClassPathResource(<span style=\"color: #98c379;line-height: 26px;\">\"application2.yml\"<\/span>));Map&lt;String,Object&gt;map=yamlMapFb.getObject();System.out.println(map);}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u6253\u5370\u7ed3\u679c\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\">{person2={name=susan,gender=female,age=18}}<\/code><\/pre>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;color: black;font-size: 22px;text-align: center;background-image: url('https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215710941.png');background-position: center center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 50px;margin-top: 1em;margin-bottom: 10px;\"><span style=\"display: none;\"><\/span><span style=\"display: inline-block;height: 38px;line-height: 42px;color: rgb(72, 179, 120);background-position: left center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 63px;margin-top: 38px;font-size: 18px;margin-bottom: 10px;\">3\u3001\u76d1\u542c\u4e8b\u4ef6<\/span><\/h2>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u5728\u4e0a\u7bc7\u4ecb\u7ecd\u539f\u7406\u7684\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u77e5\u9053SpringBoot\u662f\u901a\u8fc7\u76d1\u542c\u4e8b\u4ef6\u7684\u65b9\u5f0f\u6765\u52a0\u8f7d\u548c\u89e3\u6790\u7684yml\u6587\u4ef6\uff0c\u90a3\u4e48\u6211\u4eec\u4e5f\u53ef\u4ee5\u4eff\u7167\u8fd9\u4e2a\u6a21\u5f0f\uff0c\u6765\u52a0\u8f7d\u81ea\u5b9a\u4e49\u7684\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u9996\u5148\uff0c\u5b9a\u4e49\u4e00\u4e2a\u7c7b\u5b9e\u73b0<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">ApplicationListener<\/code>\u63a5\u53e3\uff0c\u76d1\u542c\u7684\u4e8b\u4ef6\u7c7b\u578b\u4e3a<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">ApplicationEnvironmentPreparedEvent<\/code>\uff0c\u5e76\u5728\u6784\u9020\u65b9\u6cd5\u4e2d\u4f20\u5165\u8981\u89e3\u6790\u7684yml\u6587\u4ef6\u540d\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span><span style=\"color: #e6c07b;line-height: 26px;\">YmlListener<\/span><span style=\"color: #c678dd;line-height: 26px;\">implements<\/span><span style=\"color: #e6c07b;line-height: 26px;\">ApplicationListener<\/span>&lt;<span style=\"color: #e6c07b;line-height: 26px;\">ApplicationEnvironmentPreparedEvent<\/span>&gt;<\/span>{<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>StringymlFilePath;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"color: #61aeee;line-height: 26px;\">YmlListener<\/span><span style=\"line-height: 26px;\">(StringymlFilePath)<\/span><\/span>{<span style=\"color: #c678dd;line-height: 26px;\">this<\/span>.ymlFilePath=ymlFilePath;}<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/...<\/span>}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u81ea\u5b9a\u4e49\u7684\u76d1\u542c\u5668\u4e2d\u9700\u8981\u5b9e\u73b0\u63a5\u53e3\u7684<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">onApplicationEvent()<\/code>\u65b9\u6cd5\uff0c\u5f53\u76d1\u542c\u5230<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">ApplicationEnvironmentPreparedEvent<\/code>\u4e8b\u4ef6\u65f6\u4f1a\u88ab\u89e6\u53d1\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"color: #61aeee;line-height: 26px;\">@Override<\/span><span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"color: #c678dd;line-height: 26px;\">void<\/span><span style=\"color: #61aeee;line-height: 26px;\">onApplicationEvent<\/span><span style=\"line-height: 26px;\">(ApplicationEnvironmentPreparedEventevent)<\/span><\/span>{ConfigurableEnvironmentenvironment=event.getEnvironment();ResourceLoaderloader=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>DefaultResourceLoader();YamlPropertySourceLoaderymlLoader=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>YamlPropertySourceLoader();<span style=\"color: #c678dd;line-height: 26px;\">try<\/span>{List&lt;PropertySource&lt;?&gt;&gt;sourceList=ymlLoader.load(ymlFilePath,loader.getResource(ymlFilePath));<span style=\"color: #c678dd;line-height: 26px;\">for<\/span>(PropertySource&lt;?&gt;propertySource:sourceList){environment.getPropertySources().addLast(propertySource);}}<span style=\"color: #c678dd;line-height: 26px;\">catch<\/span>(IOExceptione){e.printStackTrace();}}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u4e0a\u9762\u7684\u4ee3\u7801\u4e2d\uff0c\u4e3b\u8981\u5b9e\u73b0\u4e86\uff1a<\/p>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\u83b7\u53d6\u5f53\u524d\u73af\u5883<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">Environment<\/code>\uff0c\u5f53<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">ApplicationEnvironmentPreparedEvent<\/code>\u4e8b\u4ef6\u88ab\u89e6\u53d1\u65f6\uff0c\u5df2\u7ecf\u5b8c\u6210\u4e86<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">Environment<\/code>\u7684\u88c5\u8f7d\uff0c\u5e76\u4e14\u80fd\u591f\u901a\u8fc7<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">event<\/code>\u4e8b\u4ef6\u83b7\u53d6<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\u901a\u8fc7<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">YamlPropertySourceLoader<\/code>\u52a0\u8f7d\u3001\u89e3\u6790\u914d\u7f6e\u6587\u4ef6<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\u5c06\u89e3\u6790\u5b8c\u6210\u540e\u7684<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">OriginTrackedMapPropertySource<\/code>\u6dfb\u52a0\u5230<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">Environment<\/code>\u4e2d<\/section>\n<\/li>\n<\/ul>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u4fee\u6539\u542f\u52a8\u7c7b\uff0c\u5728\u542f\u52a8\u7c7b\u4e2d\u52a0\u5165\u8fd9\u4e2a\u76d1\u542c\u5668\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"color: #c678dd;line-height: 26px;\">static<\/span><span style=\"color: #c678dd;line-height: 26px;\">void<\/span><span style=\"color: #61aeee;line-height: 26px;\">main<\/span><span style=\"line-height: 26px;\">(String[]args)<\/span><\/span>{SpringApplicationapplication=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>SpringApplication(MyApplication<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)<\/span>;application.addListeners(<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>YmlListener(<span style=\"color: #98c379;line-height: 26px;\">\"classpath:\/application2.yml\"<\/span>));application.run(args);}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u5728\u5411<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">environment<\/code>\u4e2d\u6dfb\u52a0<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">propertySource<\/code>\u524d\u52a0\u4e00\u4e2a\u65ad\u70b9\uff0c\u67e5\u770b\u73af\u5883\u7684\u53d8\u5316\uff1a<\/p>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-imgfileid=\"100041820\" data-ratio=\"0.2564814814814815\"  data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;border-radius: 4px;margin-bottom: 25px;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215733951.webp\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-imgfileid=\"100041820\" data-ratio=\"0.2564814814814815\"  data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;border-radius: 4px;margin-bottom: 25px;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215733951.webp\"  \/><\/noscript><\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u6267\u884c\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u770b\u5230\u914d\u7f6e\u6587\u4ef6\u6e90\u5df2\u7ecf\u88ab\u6dfb\u52a0\u5230\u4e86\u73af\u5883\u4e2d\uff1a<\/p>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-imgfileid=\"100041818\" data-ratio=\"0.2777777777777778\"  data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;border-radius: 4px;margin-bottom: 25px;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215733900.webp\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-imgfileid=\"100041818\" data-ratio=\"0.2777777777777778\"  data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;border-radius: 4px;margin-bottom: 25px;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215733900.webp\"  \/><\/noscript><\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u542f\u52a8\u5b8c\u6210\u540e\u518d\u8c03\u7528\u4e00\u4e0b\u63a5\u53e3\uff0c\u67e5\u770b\u7ed3\u679c\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\">susanfemale<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u80fd\u591f\u6b63\u786e\u7684\u53d6\u5230\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u503c\uff0c\u8bf4\u660e\u81ea\u5b9a\u4e49\u7684\u76d1\u542c\u5668\u5df2\u7ecf\u751f\u6548\u3002<\/p>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;color: black;font-size: 22px;text-align: center;background-image: url('https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215710941.png');background-position: center center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 50px;margin-top: 1em;margin-bottom: 10px;\"><span style=\"display: none;\"><\/span><span style=\"display: inline-block;height: 38px;line-height: 42px;color: rgb(72, 179, 120);background-position: left center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 63px;margin-top: 38px;font-size: 18px;margin-bottom: 10px;\">4\u3001SnakeYml<\/span><\/h2>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u524d\u9762\u4ecb\u7ecd\u7684\u51e0\u79cd\u65b9\u5f0f\uff0c\u5728Spring\u73af\u5883\u4e0b\u65e0\u9700\u5f15\u5165\u5176\u4ed6\u4f9d\u8d56\u5c31\u53ef\u4ee5\u5b8c\u6210\u7684\uff0c\u63a5\u4e0b\u6765\u8981\u4ecb\u7ecd\u7684<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">SnakeYml<\/code>\u5728\u4f7f\u7528\u524d\u9700\u8981\u5f15\u5165\u4f9d\u8d56\uff0c\u4f46\u662f\u540c\u65f6\u4e5f\u53ef\u4ee5\u8131\u79bbSpring\u73af\u5883\u5355\u72ec\u4f7f\u7528\u3002\u5148\u5f15\u5165\u4f9d\u8d56\u5750\u6807\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span><span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>org.yaml<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span><span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>snakeyaml<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span><span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>1.23<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span><span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u51c6\u5907\u4e00\u4e2ayml\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\">person1:name:hydragender:maleperson2:name:susangender:female<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u5728\u4f7f\u7528<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">SnakeYml<\/code>\u89e3\u6790yml\u65f6\uff0c\u6700\u5e38\u4f7f\u7528\u7684\u5c31\u662f<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">load<\/code>\u3001<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">loadlAll<\/code>\u3001<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">loadAs<\/code>\u65b9\u6cd5\uff0c\u8fd9\u4e09\u4e2a\u65b9\u6cd5\u53ef\u4ee5\u52a0\u8f7dyml\u6587\u4ef6\u6216\u5b57\u7b26\u4e32\uff0c\u6700\u540e\u8fd4\u56de\u89e3\u6790\u540e\u7684\u5bf9\u8c61\u3002\u6211\u4eec\u5148\u4ece\u57fa\u7840\u7684<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">load<\/code>\u65b9\u6cd5\u5f00\u59cb\u6f14\u793a\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"color: #c678dd;line-height: 26px;\">void<\/span><span style=\"color: #61aeee;line-height: 26px;\">test1<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{Yamlyaml=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>Yaml();Map&lt;String,Object&gt;map=yaml.load(getClass().getClassLoader().getResourceAsStream(<span style=\"color: #98c379;line-height: 26px;\">\"snake1.yml\"<\/span>));System.out.println(map);}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u8fd0\u884c\u4e0a\u9762\u7684\u4ee3\u7801\uff0c\u6253\u5370Map\u4e2d\u7684\u5185\u5bb9\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\">{person1={name=hydra,gender=male},person2={name=susan,gender=female}}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u63a5\u4e0b\u6765\u770b\u4e00\u4e0b<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">loadAll<\/code>\u65b9\u6cd5\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u52a0\u8f7dyml\u4e2d\u4f7f\u7528<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">---<\/code>\u8fde\u63a5\u7b26\u8fde\u63a5\u7684\u591a\u4e2a\u6587\u6863\uff0c\u5c06\u4e0a\u9762\u7684yml\u6587\u4ef6\u8fdb\u884c\u4fee\u6539\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\">person1:name:hydragender:male---person2:name:susangender:female<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u5728\u6dfb\u52a0\u4e86\u8fde\u63a5\u7b26\u540e\uff0c\u5c1d\u8bd5\u518d\u4f7f\u7528<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">load<\/code>\u65b9\u6cd5\u8fdb\u884c\u89e3\u6790\uff0c\u62a5\u9519\u5982\u4e0b\u663e\u793a\u53d1\u73b0\u4e86\u53e6\u4e00\u6bb5yml\u6587\u6863\u4ece\u800c\u65e0\u6cd5\u6b63\u5e38\u89e3\u6790\uff1a<\/p>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-imgfileid=\"100041819\" data-ratio=\"0.45454545454545453\"  data-w=\"946\" style=\"display: block;margin-right: auto;margin-left: auto;border-radius: 4px;margin-bottom: 25px;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215734409.webp\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-imgfileid=\"100041819\" data-ratio=\"0.45454545454545453\"  data-w=\"946\" style=\"display: block;margin-right: auto;margin-left: auto;border-radius: 4px;margin-bottom: 25px;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215734409.webp\"  \/><\/noscript><\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u8fd9\u65f6\u5019\u4fee\u6539\u4e0a\u9762\u7684\u4ee3\u7801\uff0c\u4f7f\u7528<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">loadAll<\/code>\u65b9\u6cd5\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"color: #c678dd;line-height: 26px;\">void<\/span><span style=\"color: #61aeee;line-height: 26px;\">test2<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{Yamlyaml=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>Yaml();Iterable&lt;Object&gt;objects=yaml.loadAll(getClass().getClassLoader().getResourceAsStream(<span style=\"color: #98c379;line-height: 26px;\">\"snake2.yml\"<\/span>));<span style=\"color: #c678dd;line-height: 26px;\">for<\/span>(Objectobject:objects){System.out.println(object);}}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u6267\u884c\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\">{person1={name=hydra,gender=male}}{person2={name=susan,gender=female}}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u53ef\u4ee5\u770b\u5230\uff0c<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">loadAll<\/code>\u65b9\u6cd5\u8fd4\u56de\u7684\u662f\u4e00\u4e2a\u5bf9\u8c61\u7684\u8fed\u4ee3\uff0c\u91cc\u9762\u7684\u6bcf\u4e2a\u5bf9\u8c61\u5bf9\u5e94yml\u4e2d\u7684\u4e00\u6bb5\u6587\u6863\uff0c\u4fee\u6539\u540e\u7684yml\u6587\u4ef6\u5c31\u88ab\u89e3\u6790\u6210\u4e86\u4e24\u4e2a\u72ec\u7acb\u7684Map\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u63a5\u4e0b\u6765\u518d\u6765\u770b\u4e00\u4e0b<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">loadAs<\/code>\u65b9\u6cd5\uff0c\u5b83\u53ef\u4ee5\u5728yml\u89e3\u6790\u8fc7\u7a0b\u4e2d\u6307\u5b9a\u7c7b\u578b\uff0c\u76f4\u63a5\u5c01\u88c5\u6210\u4e00\u4e2a\u5bf9\u8c61\u3002\u6211\u4eec\u76f4\u63a5\u590d\u7528\u4e0a\u9762\u7684<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">snake1.yml<\/code>\uff0c\u5728\u89e3\u6790\u524d\u5148\u521b\u5efa\u4e24\u4e2a\u5b9e\u4f53\u7c7b\u5bf9\u8c61\u7528\u4e8e\u63a5\u6536\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"color: #61aeee;line-height: 26px;\">@Data<\/span><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span><span style=\"color: #e6c07b;line-height: 26px;\">Person<\/span><\/span>{SinglePersonperson1;SinglePersonperson2;}<span style=\"color: #61aeee;line-height: 26px;\">@Data<\/span><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span><span style=\"color: #e6c07b;line-height: 26px;\">SinglePerson<\/span><\/span>{Stringname;Stringgender;}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u4e0b\u9762\u4f7f\u7528<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">loadAs<\/code>\u65b9\u6cd5\u52a0\u8f7dyml\uff0c\u6ce8\u610f\u65b9\u6cd5\u7684\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff0c\u5c31\u662f\u7528\u4e8e\u5c01\u88c5yml\u7684\u5b9e\u4f53\u7c7b\u578b\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"color: #c678dd;line-height: 26px;\">void<\/span><span style=\"color: #61aeee;line-height: 26px;\">test3<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{Yamlyaml=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>Yaml();Personperson=yaml.loadAs(getClass().getClassLoader().getResourceAsStream(<span style=\"color: #98c379;line-height: 26px;\">\"snake1.yml\"<\/span>),Person<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)<\/span>;System.out.println(person.toString());}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u67e5\u770b\u6267\u884c\u7ed3\u679c\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\">Person(person1=SinglePerson(name=hydra,gender=male),person2=SinglePerson(name=susan,gender=female))<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u5b9e\u9645\u4e0a\uff0c\u5982\u679c\u60f3\u8981\u5c06yml\u5c01\u88c5\u6210\u5b9e\u4f53\u5bf9\u8c61\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u53e6\u4e00\u79cd\u65b9\u6cd5\u3002\u5728\u521b\u5efa<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">Yaml<\/code>\u5bf9\u8c61\u7684\u65f6\u5019\uff0c\u4f20\u5165\u4e00\u4e2a\u6307\u5b9a\u5b9e\u4f53\u7c7b\u7684\u6784\u9020\u5668\u5bf9\u8c61\uff0c\u7136\u540e\u76f4\u63a5\u8c03\u7528<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">load<\/code>\u65b9\u6cd5\u5c31\u53ef\u4ee5\u5b9e\u73b0\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"color: #c678dd;line-height: 26px;\">void<\/span><span style=\"color: #61aeee;line-height: 26px;\">test4<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{Yamlyaml=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>Yaml(<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>Constructor(Person<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>))<\/span>;Personperson=yaml.load(getClass().getClassLoader().getResourceAsStream(<span style=\"color: #98c379;line-height: 26px;\">\"snake1.yml\"<\/span>));System.out.println(person.toString());}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u6267\u884c\u7ed3\u679c\u4e0e\u4e0a\u9762\u76f8\u540c\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\">Person(person1=SinglePerson(name=hydra,gender=male),person2=SinglePerson(name=susan,gender=female))<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">SnakeYml\u5176\u5b9e\u5b9e\u73b0\u4e86\u975e\u5e38\u591a\u7684\u529f\u80fd\uff0c\u8fd9\u91cc\u5c31\u4e0d\u4e00\u4e00\u5217\u4e3e\u4e86\uff0c\u6709\u5174\u8da3\u7684\u5c0f\u4f19\u4f34\u53ef\u4ee5\u81ea\u5df1\u67e5\u770b\u4e00\u4e0b\u6587\u6863\u3002\u5982\u679c\u4f60\u770b\u4e86\u4e0a\u4e00\u7bc7\u7684\u6587\u7ae0\u540e\u8ddf\u7740\u7ffb\u9605\u4e86\u4e00\u4e0b\u6e90\u7801\uff0c\u90a3\u4e48\u4f60\u4f1a\u53d1\u73b0\uff0c\u5176\u5b9e\u5728SpringBoot\u7684\u5e95\u5c42\uff0c\u4e5f\u662f\u501f\u52a9\u4e86SnakeYml\u6765\u8fdb\u884c\u7684yml\u7684\u89e3\u6790\u64cd\u4f5c\u3002<\/p>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;color: black;font-size: 22px;text-align: center;background-image: url('https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215710941.png');background-position: center center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 50px;margin-top: 1em;margin-bottom: 10px;\"><span style=\"display: none;\"><\/span><span style=\"display: inline-block;height: 38px;line-height: 42px;color: rgb(72, 179, 120);background-position: left center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 63px;margin-top: 38px;font-size: 18px;margin-bottom: 10px;\">5\u3001jackson-dataformat-yaml<\/span><\/h2>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u76f8\u6bd4\u5927\u5bb6\u5e73\u5e38\u7528jackson\u6bd4\u8f83\u591a\u7684\u573a\u666f\u662f\u7528\u5b83\u6765\u5904\u7406json\uff0c\u5176\u5b9e\u5b83\u4e5f\u53ef\u4ee5\u7528\u6765\u5904\u7406yml\uff0c\u4f7f\u7528\u524d\u9700\u8981\u5f15\u5165\u4f9d\u8d56\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span><span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>com.fasterxml.jackson.dataformat<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span><span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>jackson-dataformat-yaml<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span><span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>2.12.3<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span><span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u4f7f\u7528jackson\u8bfb\u53d6yml\u4e5f\u975e\u5e38\u7b80\u5355\uff0c\u8fd9\u91cc\u7528\u5230\u4e86\u5e38\u7528\u7684<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">ObjectMapper<\/code>\uff0c\u5728\u521b\u5efa<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">ObjectMapper<\/code>\u5bf9\u8c61\u65f6\u6307\u5b9a\u4f7f\u7528<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">YAML<\/code>\u5de5\u5382\uff0c\u4e4b\u540e\u5c31\u53ef\u4ee5\u7b80\u5355\u7684\u5c06yml\u6620\u5c04\u5230\u5b9e\u4f53\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"color: #c678dd;line-height: 26px;\">void<\/span><span style=\"color: #61aeee;line-height: 26px;\">read<\/span><span style=\"line-height: 26px;\">()<\/span><span style=\"color: #c678dd;line-height: 26px;\">throws<\/span>IOException<\/span>{ObjectMapperobjectMapper=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>ObjectMapper(<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>YAMLFactory());InputStreaminput=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>FileInputStream(<span style=\"color: #98c379;line-height: 26px;\">\"F:\\Work\\yml\\src\\main\\resources\\snake1.yml\"<\/span>);Personperson=objectMapper.readValue(input,Person<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)<\/span>;System.out.println(person.toString());}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\">Person(person1=SinglePerson(name=hydra,gender=male),person2=SinglePerson(name=susan,gender=female))<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u5982\u679c\u60f3\u8981\u751f\u6210yml\u6587\u4ef6\u7684\u8bdd\uff0c\u53ef\u4ee5\u8c03\u7528<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">ObjectMapper<\/code>\u7684<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">writeValue<\/code>\u65b9\u6cd5\u5b9e\u73b0\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;\"><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;\"><span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span><span style=\"color: #c678dd;line-height: 26px;\">void<\/span><span style=\"color: #61aeee;line-height: 26px;\">write<\/span><span style=\"line-height: 26px;\">()<\/span><span style=\"color: #c678dd;line-height: 26px;\">throws<\/span>IOException<\/span>{Map&lt;String,Object&gt;map=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>HashMap&lt;&gt;();SinglePersonperson1=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>SinglePerson(<span style=\"color: #98c379;line-height: 26px;\">\"Trunks\"<\/span>,<span style=\"color: #98c379;line-height: 26px;\">\"male\"<\/span>);SinglePersonperson2=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>SinglePerson(<span style=\"color: #98c379;line-height: 26px;\">\"Goten\"<\/span>,<span style=\"color: #98c379;line-height: 26px;\">\"male\"<\/span>);Personperson=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>Person(person1,person2);map.put(<span style=\"color: #98c379;line-height: 26px;\">\"person\"<\/span>,person);ObjectMapperobjectMapper=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>ObjectMapper(<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>YAMLFactory());objectMapper.writeValue(<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>File(<span style=\"color: #98c379;line-height: 26px;\">\"F:\\Work\\yml\\src\\main\\resources\\jackson-gen.yml\"<\/span>),map);}<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u67e5\u770b\u751f\u6210\u7684yml\u6587\u4ef6\uff0c\u53ef\u4ee5\u770b\u5230jackson\u5bf9\u5b57\u7b26\u4e32\u7c7b\u578b\u4e25\u683c\u7684\u6dfb\u52a0\u4e86\u5f15\u53f7\uff0c\u8fd8\u5728\u6587\u6863\u7684\u5f00\u5934\u6dfb\u52a0\u4e86yml\u7684\u94fe\u63a5\u7b26\u3002\u81f3\u4e8e\u5176\u4ed6jackson\u8bfb\u5199yml\u7684\u590d\u6742\u529f\u80fd\uff0c\u5927\u5bb6\u53ef\u4ee5\u5728\u5de5\u4f5c\u4e2d\u81ea\u5df1\u53bb\u63a2\u7d22\u4f7f\u7528\u3002<\/p>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-imgfileid=\"100041823\" data-ratio=\"0.8773841961852861\"  data-w=\"367\" style=\"display: block;margin-right: auto;margin-left: auto;border-radius: 4px;margin-bottom: 25px;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215734963.webp\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-imgfileid=\"100041823\" data-ratio=\"0.8773841961852861\"  data-w=\"367\" style=\"display: block;margin-right: auto;margin-left: auto;border-radius: 4px;margin-bottom: 25px;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215734963.webp\"  \/><\/noscript><\/figure>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;color: black;font-size: 22px;text-align: center;background-image: url('https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215710941.png');background-position: center center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 50px;margin-top: 1em;margin-bottom: 10px;\"><span style=\"display: none;\"><\/span><span style=\"display: inline-block;height: 38px;line-height: 42px;color: rgb(72, 179, 120);background-position: left center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 63px;margin-top: 38px;font-size: 18px;margin-bottom: 10px;\">\u603b\u7ed3<\/span><\/h2>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u672c\u6587\u4ecb\u7ecd\u4e865\u79cd\u8bfb\u53d6yml\u914d\u7f6e\u6587\u4ef6\u7684\u65b9\u5f0f\uff0c\u524d3\u79cd\u4f9d\u8d56\u4e8eSpring\u73af\u5883\uff0c\u800c<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">SnakeYml<\/code>\u548c<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">Jackson<\/code>\u5219\u53ef\u4ee5\u8131\u79bb\u73af\u5883\u72ec\u7acb\u4f7f\u7528\uff0c\u53ef\u4ee5\u8bf4\u5b83\u4eec\u662f\u5bf9<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">@Value<\/code>\u548c<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">@ConfigurationProperties<\/code>\u6ce8\u89e3\u4f7f\u7528\u7684\u8865\u5145\u3002\u8fd9\u51e0\u79cd\u65b9\u6cd5\u7684\u4f7f\u7528\u573a\u666f\u4e0d\u540c\uff0c\u4e5f\u5404\u6709\u5404\u7684\u6709\u4f18\u70b9\uff0c\u5404\u81ea\u5177\u5907\u4e00\u4e9b\u7279\u6b8a\u7684\u7528\u6cd5\uff0c\u800c\u6211\u4eec\u5728\u5de5\u4f5c\u4e2d\u66f4\u591a\u60c5\u51b5\u4e0b\uff0c\u8981\u6839\u636e\u5177\u4f53\u7684\u7528\u9014\u8fdb\u884c\u4e00\u79cd\u65b9\u6848\u7684\u9009\u53d6\u6216\u591a\u79cd\u7684\u642d\u914d\u4f7f\u7528\u3002<\/p>\n<hr data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;height: 1px;border-width: initial;border-style: none;border-color: initial;text-align: center;background-image: linear-gradient(to right, rgba(93, 186, 133, 0), rgba(93, 186, 133, 0.75), rgba(93, 186, 133, 0));\"  \/>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">Github\u4e0a<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">\u6807\u661f60K<\/code>\u7684\u7535\u5546\u5b9e\u6218\u9879\u76eemall\uff0c\u5168\u5957 <a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzU1Nzg4NjgyMw==&amp;mid=2247510592&amp;idx=1&amp;sn=ca49cdaf727c5d9cb94ae774fe0d7643&amp;scene=21#wechat_redirect\" style=\"font-weight: bold;color: rgb(72, 179, 120);border-bottom: 1px solid rgb(72, 179, 120);\" data-linktype=\"2\" target=\"_blank\"  rel=\"nofollow\" >\u89c6\u9891\u6559\u7a0b\uff082023\u6700\u65b0\u7248\uff09<\/a> \u5df2\u66f4\u65b0\u5b8c\u6bd5\uff01\u5168\u5957\u6559\u7a0b<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">\u7ea640\u5c0f\u65f6\uff0c\u5171113\u671f<\/code>\uff0c\u901a\u8fc7\u8fd9\u5957\u6559\u7a0b\u4f60\u53ef\u4ee5\u62e5\u6709\u4e00\u4e2a<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">\u6db5\u76d6\u4e3b\u6d41Java\u6280\u672f\u6808\u7684\u5b8c\u6574\u9879\u76ee\u7ecf\u9a8c<\/code>\uff0c\u540c\u65f6\u63d0\u9ad8\u81ea\u5df1<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">\u72ec\u7acb\u5f00\u53d1\u4e00\u4e2a\u9879\u76ee\u7684\u80fd\u529b<\/code>\uff0c\u4e0b\u9762\u662f\u9879\u76ee\u7684\u6574\u4f53\u67b6\u6784\u56fe\uff0c\u611f\u5174\u8da3\u7684\u5c0f\u4f19\u4f34\u53ef\u4ee5\u70b9\u51fb\u94fe\u63a5 <a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzU1Nzg4NjgyMw==&amp;mid=2247510592&amp;idx=1&amp;sn=ca49cdaf727c5d9cb94ae774fe0d7643&amp;scene=21#wechat_redirect\" style=\"font-weight: bold;color: rgb(72, 179, 120);border-bottom: 1px solid rgb(72, 179, 120);\" data-linktype=\"2\" target=\"_blank\"  rel=\"nofollow\" >mall\u89c6\u9891\u6559\u7a0b<\/a> \u52a0\u5165\u5b66\u4e60\u3002<\/p>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-imgfileid=\"100041827\" data-ratio=\"0.7166666666666667\"  data-type=\"jpeg\" data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;border-radius: 4px;margin-bottom: 25px;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215735565.jpeg\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-imgfileid=\"100041827\" data-ratio=\"0.7166666666666667\"  data-type=\"jpeg\" data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;border-radius: 4px;margin-bottom: 25px;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215735565.jpeg\"  \/><\/noscript><\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-bottom: 8px;padding-top: 1em;color: rgb(74, 74, 74);line-height: 1.75em;\">\u6574\u5957 <a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzU1Nzg4NjgyMw==&amp;mid=2247510592&amp;idx=1&amp;sn=ca49cdaf727c5d9cb94ae774fe0d7643&amp;scene=21#wechat_redirect\" style=\"font-weight: bold;color: rgb(72, 179, 120);border-bottom: 1px solid rgb(72, 179, 120);\" data-linktype=\"2\" target=\"_blank\"  rel=\"nofollow\" >\u89c6\u9891\u6559\u7a0b<\/a> \u7684\u5185\u5bb9\u8fd8\u662f\u975e\u5e38\u5b8c\u5584\u7684\uff0c\u6db5\u76d6\u4e86mall\u9879\u76ee\u6700\u4f73\u5b66\u4e60\u8def\u7ebf\u3001\u6574\u4f53\u6846\u67b6\u642d\u5efa\u3001\u4e1a\u52a1\u4e0e\u6280\u672f\u5b9e\u73b0\u5168\u65b9\u4f4d\u89e3\u6790\u3001\u7ebf\u4e0aDocker\u73af\u5883\u90e8\u7f72\u3001\u5fae\u670d\u52a1\u9879\u76ee\u5b66\u4e60\u7b49\u5185\u5bb9\uff0c\u4f60\u4e5f\u53ef\u4ee5\u70b9\u51fb\u94fe\u63a5 <a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzU1Nzg4NjgyMw==&amp;mid=2247510592&amp;idx=1&amp;sn=ca49cdaf727c5d9cb94ae774fe0d7643&amp;scene=21#wechat_redirect\" style=\"font-weight: bold;color: rgb(72, 179, 120);border-bottom: 1px solid rgb(72, 179, 120);\" data-linktype=\"2\" target=\"_blank\"  rel=\"nofollow\" >mall\u89c6\u9891\u6559\u7a0b<\/a> \u4e86\u89e3\u66f4\u591a\u5185\u5bb9\u3002<\/p>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;color: black;font-size: 22px;text-align: center;background-image: url('https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215710941.png');background-position: center center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 50px;margin-top: 1em;margin-bottom: 10px;\"><span style=\"display: none;\"><\/span><span style=\"display: inline-block;height: 38px;line-height: 42px;color: rgb(72, 179, 120);background-position: left center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 63px;margin-top: 38px;font-size: 18px;margin-bottom: 10px;\">\u63a8\u8350\u9605\u8bfb<\/span><\/h2>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: black;\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzU1Nzg4NjgyMw==&amp;mid=2247523575&amp;idx=1&amp;sn=3a3b527b57dc985968854839a915a5dc&amp;scene=21#wechat_redirect\" style=\"font-weight: bold;color: rgb(72, 179, 120);border-bottom: 1px solid rgb(72, 179, 120);\" data-linktype=\"2\" target=\"_blank\"  rel=\"nofollow\" >\u5168\u9762\u5347\u7ea7\uff01\u4e00\u5957\u57fa\u4e8eSpring Boot 3+JDK17\u7684\u5b9e\u6218\u9879\u76ee\uff01<\/a><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzU1Nzg4NjgyMw==&amp;mid=2247512035&amp;idx=1&amp;sn=711bb886c3b51d4c69e3a0aee8219be8&amp;scene=21#wechat_redirect\" style=\"font-weight: bold;color: rgb(72, 179, 120);border-bottom: 1px solid rgb(72, 179, 120);\" data-linktype=\"2\" target=\"_blank\"  rel=\"nofollow\" >69K Star\uff01\u8fd9\u662f\u6211\u89c1\u8fc7\u6700\u5f3a\u7684\u5f00\u6e90\u7535\u5546\u7cfb\u7edf \uff01\uff01<\/a><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzU1Nzg4NjgyMw==&amp;mid=2247510592&amp;idx=1&amp;sn=ca49cdaf727c5d9cb94ae774fe0d7643&amp;scene=21#wechat_redirect\" style=\"font-weight: bold;color: rgb(72, 179, 120);border-bottom: 1px solid rgb(72, 179, 120);\" data-linktype=\"2\" target=\"_blank\"  rel=\"nofollow\" >Github\u6807\u661f60K\uff01\u4e00\u5957\u5b8c\u6574\u7684\u9879\u76ee\u5b9e\u6218\u6559\u7a0b\u6765\u4e86\uff0c\u4e3b\u6d41Java\u6280\u672f\u4e00\u7f51\u6253\u5c3d\uff01<\/a><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzU1Nzg4NjgyMw==&amp;mid=2247513826&amp;idx=1&amp;sn=0f582ade89a5d300a3a2dbd1247a54f1&amp;scene=21#wechat_redirect\" style=\"font-weight: bold;color: rgb(72, 179, 120);border-bottom: 1px solid rgb(72, 179, 120);\" data-linktype=\"2\" target=\"_blank\"  rel=\"nofollow\" >\u770b\u4e86\u6211\u9879\u76ee\u4e2d\u8d2d\u7269\u8f66\u3001\u8ba2\u5355\u3001\u652f\u4ed8\u4e00\u6574\u5957\u8bbe\u8ba1\uff0c\u540c\u4e8b\u4e5f\u5f00\u59cb\u6084\u6084\u6a21\u4eff\u4e86...<\/a><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzU1Nzg4NjgyMw==&amp;mid=2247513093&amp;idx=1&amp;sn=03fb22d469f50f03793030e9a0c30551&amp;scene=21#wechat_redirect\" style=\"font-weight: bold;color: rgb(72, 179, 120);border-bottom: 1px solid rgb(72, 179, 120);\" data-linktype=\"2\" target=\"_blank\"  rel=\"nofollow\" >\u652f\u4ed8\u7cfb\u7edf\u5c31\u8be5\u8fd9\u4e48\u8bbe\u8ba1\uff0c\u7a33\u7684\u4e00\u6279\uff01<\/a><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzU1Nzg4NjgyMw==&amp;mid=2247508732&amp;idx=1&amp;sn=3d10d005c554c43e7ce601aec4a94fda&amp;scene=21#wechat_redirect\" style=\"font-weight: bold;color: rgb(72, 179, 120);border-bottom: 1px solid rgb(72, 179, 120);\" data-linktype=\"2\" target=\"_blank\"  rel=\"nofollow\" >\u6743\u9650\u7cfb\u7edf\u5c31\u8be5\u8fd9\u4e48\u8bbe\u8ba1\uff0c\u7a33\u7684\u4e00\u6279\uff01<\/a><\/section>\n<\/li>\n<\/ul>\n<\/section>\n<section class=\"mp_profile_iframe_wrp\"><mp-common-profile class=\"js_uneditable custom_select_card mp_profile_iframe\" data-pluginname=\"mpprofile\" data-id=\"MzU1Nzg4NjgyMw==\" data-headimg=\"http:\/\/mmbiz.qpic.cn\/mmbiz_png\/CKvMdchsUwnfLzMS3eAE7gXUvx6GYmnzuANVe5zJIGp0C084ANIia7Xo1nSADddF3eiajuhKDf0EofjI4t7hdqyA\/0?wx_fmt=png\" data-nickname=\"macrozheng\" data-alias=\"\" data-signature=\"\u4e13\u6ce8Java\u6280\u672f\u5206\u4eab\uff0c\u89e3\u6790\u4f18\u8d28\u5f00\u6e90\u9879\u76ee\u3002\u6db5\u76d6SpringBoot\u3001SpringCloud\u3001Docker\u3001K8S\u7b49\u5b9e\u7528\u6280\u672f\uff0c\u4f5c\u8005Github\u5f00\u6e90\u9879\u76eemall\uff0850K+Star\uff09\u3002\" data-from=\"0\" data-is_biz_ban=\"0\"><\/mp-common-profile><\/section>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100005812\" data-ratio=\"0.2777777777777778\"  data-type=\"gif\" data-w=\"1080\" style=\"\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215739441.gif\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100005812\" data-ratio=\"0.2777777777777778\"  data-type=\"gif\" data-w=\"1080\" style=\"\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215739441.gif\"  \/><\/noscript><\/p>\n<blockquote>\n<p>\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e\u5fae\u4fe1\u516c\u4f17\u53f7:                 macrozheng              <\/p>\n<\/blockquote>\n<\/div>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>mall\u5b66\u4e60\u6559\u7a0b\u5b98\u7f51\uff1amacrozheng.com \u5728\u4e0a\u4e00\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u4ece\u6e90\u7801\u89d2\u5ea6\u5206\u6790\u4e86SpringBoot\u89e3\u6790yml\u914d\u7f6e\u6587\u4ef6\u7684\u5168 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":5146,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[7],"tags":[],"class_list":["post-5158","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring-boot"],"post_thumbnail_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215712995-150x113.jpeg","content_first_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215720580.png","post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215712995.jpeg","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215712995.jpeg","post_frist_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215720580.png","post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215712995.jpeg","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215712995.jpeg","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215712995.jpeg","post_all_images":[{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215720580.png","id":"image0"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215720580.png","id":"image1"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215725553.gif","id":"image2"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215725553.gif","id":"image3"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215733951.webp","id":"image4"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215733951.webp","id":"image5"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215733900.webp","id":"image6"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215733900.webp","id":"image7"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215734409.webp","id":"image8"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215734409.webp","id":"image9"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215734963.webp","id":"image10"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215734963.webp","id":"image11"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215735565.jpeg","id":"image12"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215735565.jpeg","id":"image13"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215739441.gif","id":"image14"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801215739441.gif","id":"image15"}],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"Spring Boot","post_date":"2024-08-01","like_count":"0","praiseWord":"\u9f13\u52b1","copyright_state":"","excitationAd":"0","rewardedVideoAdId":"","detailAdId":"","detailAd":"0","enterpriseMinapp":"0","audios":[],"postImageUrl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230519082947553.jpg","avatarurls":[],"related_posts":null,"pageviews":333,"next_post_id":4837,"next_post_title":"MySQL\u5206\u533a\u6280\u672f\u6df1\u5165\u89e3\u6790(\u4e07\u5b57\u957f\u6587)","previous_post_id":5111,"previous_post_title":"\u7ebf\u4e0a\u73af\u5883\u51fa\u73b0\u9891\u7e41\u7684Young GC\uff0c\u5982\u4f55\u4f18\u5316\uff1f","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/5158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=5158"}],"version-history":[{"count":1,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/5158\/revisions"}],"predecessor-version":[{"id":6313,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/5158\/revisions\/6313"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media\/5146"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=5158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=5158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=5158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}