{"id":2971,"date":"2023-07-14T17:28:05","date_gmt":"2023-07-14T09:28:05","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=2971"},"modified":"2023-07-14T17:43:55","modified_gmt":"2023-07-14T09:43:55","slug":"6-%e7%a7%8d%e6%96%b9%e5%bc%8f%e8%af%bb%e5%8f%96-springboot-%e7%9a%84%e9%85%8d%e7%bd%ae%ef%bc%88%e5%8e%9f%e7%90%86%e5%ae%9e%e6%88%98%ef%bc%89","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/spring-boot\/6-%e7%a7%8d%e6%96%b9%e5%bc%8f%e8%af%bb%e5%8f%96-springboot-%e7%9a%84%e9%85%8d%e7%bd%ae%ef%bc%88%e5%8e%9f%e7%90%86%e5%ae%9e%e6%88%98%ef%bc%89\/","title":{"rendered":"6 \u79cd\u65b9\u5f0f\u8bfb\u53d6 Springboot \u7684\u914d\u7f6e\uff08\u539f\u7406+\u5b9e\u6218\uff09"},"content":{"rendered":"<section data-tool=\"mdnice\u7f16\u8f91\u5668\" data-website=\"https:\/\/www.mdnice.com\" style=\"font-size: 16px;color: black;line-height: 1.6;letter-spacing: 0px;word-break: break-word;text-align: left;padding: 3px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;\" data-mpa-powered-by=\"yiban.io\">\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\"><\/p>\n<section>\n  <span style=\"letter-spacing: 1.2px;word-spacing: 1.8px;\">\u4ece\u914d\u7f6e\u6587\u4ef6\u4e2d\u83b7\u53d6\u5c5e\u6027\u5e94\u8be5\u662f<\/span><code style=\"letter-spacing: 1.2px;word-spacing: 1.8px;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(248, 35, 35);\">SpringBoot<\/code><span style=\"letter-spacing: 1.2px;word-spacing: 1.8px;\">\u5f00\u53d1\u4e2d\u6700\u4e3a\u5e38\u7528\u7684\u529f\u80fd\u4e4b\u4e00\uff0c\u4f46\u5c31\u662f\u8fd9\u4e48\u5e38\u7528\u7684\u529f\u80fd\uff0c\u4ecd\u7136\u6709\u5f88\u591a\u5f00\u53d1\u8005\u5728\u8fd9\u4e2a\u65b9\u9762\u8e29\u5751\u3002<\/span><br \/>\n <\/section>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\"><strong style=\"color: rgb(9, 142, 252);\"><\/strong><\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u6211\u6574\u7406\u4e86\u51e0\u79cd\u83b7\u53d6\u914d\u7f6e\u5c5e\u6027\u7684\u65b9\u5f0f\uff0c\u76ee\u7684\u4e0d\u4ec5\u662f\u8981\u8ba9\u5927\u5bb6\u5b66\u4f1a\u5982\u4f55\u4f7f\u7528\uff0c\u66f4\u91cd\u8981\u7684\u662f<strong style=\"color: rgb(9, 142, 252);\">\u5f04\u6e05\u914d\u7f6e\u52a0\u8f7d\u3001\u8bfb\u53d6\u7684\u5e95\u5c42\u539f\u7406<\/strong>\uff0c\u4e00\u65e6\u51fa\u73b0\u95ee\u9898\u53ef\u4ee5\u5206\u6790\u51fa\u5176\u75c7\u7ed3\u6240\u5728\uff0c\u800c\u4e0d\u662f\u4e00\u62a5\u9519\u53d6\u4e0d\u5230\u5c5e\u6027\uff0c\u65e0\u5934\u82cd\u8747\u822c\u7684\u91cd\u542f\u9879\u76ee\uff0c\u5728\u53e5\u53e5<strong style=\"color: rgb(9, 142, 252);\">\u5367\u69fd<\/strong>\u4e2d\u9010\u6e10\u6293\u72c2\uff5e<\/p>\n<blockquote data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"border-top: none;border-right: none;border-bottom: none;font-size: 0.9em;overflow: auto;color: rgb(106, 115, 125);padding: 10px 10px 10px 20px;margin-bottom: 20px;margin-top: 20px;border-left-color: rgb(239, 112, 96);background: rgb(255, 249, 249);\">\n<p style=\"font-size: 16px;padding-top: 8px;padding-bottom: 8px;word-spacing: 1.8px;letter-spacing: 1.2px;color: black;line-height: 26px;\">\u4ee5\u4e0b\u793a\u4f8b\u6e90\u7801 Springboot \u7248\u672c\u5747\u4e3a 2.7.6<\/p>\n<\/blockquote>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u4e0b\u8fb9\u6211\u4eec\u4e00\u4e00\u8fc7\u4e0b\u8fd9\u51e0\u79cd\u73a9\u6cd5\u548c\u539f\u7406\uff0c\u770b\u770b\u6709\u54ea\u4e9b\u662f\u4f60\u6ca1\u7528\u8fc7\u7684\uff01\u8bdd\u4e0d\u591a\u8bf4\uff0c\u5f00\u59cb\u641e\uff5e<\/p>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;border-bottom: 2px solid rgb(9, 142, 252);font-size: 1.3em;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span><span style=\"display: inline-block;background: rgb(9, 142, 252);color: rgb(255, 255, 255);padding: 3px 10px 1px;border-top-right-radius: 3px;border-top-left-radius: 3px;margin-right: 3px;\">\u4e00\u3001Environment<\/span><span style=\"display: inline-block;vertical-align: bottom;border-bottom: 36px solid #efebe9;border-right: 20px solid transparent;\"> <\/span><\/h2>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u4f7f\u7528 Environment \u65b9\u5f0f\u6765\u83b7\u53d6\u914d\u7f6e\u5c5e\u6027\u503c\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u8981\u6ce8\u5165Environment\u7c7b\u8c03\u7528\u5176\u65b9\u6cd5<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(248, 35, 35);\">getProperty(\u5c5e\u6027key)<\/code>\u5373\u53ef\uff0c\u4f46\u77e5\u5176\u7136\u77e5\u5176\u6240\u4ee5\u7136\uff0c\u7b80\u5355\u4e86\u89e3\u4e0b\u5b83\u7684\u539f\u7406\uff0c\u56e0\u4e3a\u540e\u7eed\u7684\u51e0\u79cd\u83b7\u53d6\u914d\u7f6e\u7684\u65b9\u6cd5\u90fd\u548c\u5b83\u606f\u606f\u76f8\u5173\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.4575991432078348&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@Slf<\/span>4j<br><span style=\"color: #61aeee;line-height: 26px;\">@SpringBootTest<\/span><br><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">EnvironmentTest<\/span>&nbsp;<\/span>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Resource<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;Environment&nbsp;env;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Test<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">var1Test<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<\/span>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;var1&nbsp;=&nbsp;env.getProperty(<span style=\"color: #98c379;line-height: 26px;\">\"env101.var1\"<\/span>);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log.info(<span style=\"color: #98c379;line-height: 26px;\">\"Environment&nbsp;\u914d\u7f6e\u83b7\u53d6&nbsp;{}\"<\/span>,&nbsp;var1);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><\/code><\/pre>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;font-size: 20px;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span>1\u3001\u4ec0\u4e48\u662f Environment\uff1f<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">Environment \u662f springboot \u6838\u5fc3\u7684\u73af\u5883\u914d\u7f6e\u63a5\u53e3\uff0c\u5b83\u63d0\u4f9b\u4e86\u7b80\u5355\u7684\u65b9\u6cd5\u6765\u8bbf\u95ee\u5e94\u7528\u7a0b\u5e8f\u5c5e\u6027\uff0c\u5305\u62ec\u7cfb\u7edf\u5c5e\u6027\u3001\u64cd\u4f5c\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u3001\u547d\u4ee4\u884c\u53c2\u6570\u3001\u548c\u5e94\u7528\u7a0b\u5e8f\u914d\u7f6e\u6587\u4ef6\u4e2d\u5b9a\u4e49\u7684\u5c5e\u6027\u7b49\u7b49\u3002<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;font-size: 20px;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span>2\u3001\u914d\u7f6e\u521d\u59cb\u5316<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">Springboot \u7a0b\u5e8f\u542f\u52a8\u52a0\u8f7d\u6d41\u7a0b\u91cc\uff0c\u4f1a\u6267\u884c<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(248, 35, 35);\">SpringApplication.run<\/code>\u4e2d\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(248, 35, 35);\">prepareEnvironment()<\/code>\u65b9\u6cd5\u8fdb\u884c\u914d\u7f6e\u7684\u521d\u59cb\u5316\uff0c\u90a3\u521d\u59cb\u5316\u8fc7\u7a0b\u6bcf\u4e00\u6b65\u90fd\u505a\u4e86\u4ec0\u4e48\u5462\uff1f<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.28789421049456054&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;ConfigurableEnvironment&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">prepareEnvironment<\/span><span style=\"line-height: 26px;\">(SpringApplicationRunListeners&nbsp;listeners,<br>&nbsp;&nbsp;&nbsp;DefaultBootstrapContext&nbsp;bootstrapContext,&nbsp;ApplicationArguments&nbsp;applicationArguments)<\/span>&nbsp;<\/span>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/**&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;1\u3001\u521b\u5efa&nbsp;ConfigurableEnvironment&nbsp;\u5bf9\u8c61\uff1a\u9996\u5148\u8c03\u7528&nbsp;getOrCreateEnvironment()&nbsp;\u65b9\u6cd5\u83b7\u53d6\u6216\u521b\u5efa<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;ConfigurableEnvironment&nbsp;\u5bf9\u8c61\uff0c\u8be5\u5bf9\u8c61\u7528\u4e8e\u5b58\u50a8\u73af\u5883\u53c2\u6570\u3002\u5982\u679c\u5df2\u7ecf\u5b58\u5728&nbsp;ConfigurableEnvironment&nbsp;\u5bf9\u8c61\uff0c\u5219\u76f4\u63a5\u4f7f\u7528\u5b83\uff1b\u5426\u5219\uff0c\u6839\u636e\u7528\u6237\u7684\u914d\u7f6e\u548c\u9ed8\u8ba4\u914d\u7f6e\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u3002<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ConfigurableEnvironment&nbsp;environment&nbsp;=&nbsp;getOrCreateEnvironment();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;2\u3001\u89e3\u6790\u5e76\u52a0\u8f7d\u7528\u6237\u6307\u5b9a\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5c06\u5176\u4f5c\u4e3a&nbsp;PropertySource&nbsp;\u6dfb\u52a0\u5230\u73af\u5883\u5bf9\u8c61\u4e2d\u3002\u8be5\u65b9\u6cd5\u9ed8\u8ba4\u4f1a\u89e3\u6790&nbsp;application.properties&nbsp;\u548c&nbsp;application.yml&nbsp;\u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u6dfb\u52a0\u5230&nbsp;ConfigurableEnvironment&nbsp;\u5bf9\u8c61\u4e2d\u3002<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;PropertySource&nbsp;\u6216&nbsp;PropertySourcesPlaceholderConfigurer&nbsp;\u52a0\u8f7d\u5e94\u7528\u7a0b\u5e8f\u7684\u5b9a\u5236\u5316\u914d\u7f6e\u3002<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;configureEnvironment(environment,&nbsp;applicationArguments.getSourceArgs());<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;3\u3001\u52a0\u8f7d\u6240\u6709\u7684\u7cfb\u7edf\u5c5e\u6027\uff0c\u5e76\u5c06\u5b83\u4eec\u6dfb\u52a0\u5230&nbsp;ConfigurableEnvironment&nbsp;\u5bf9\u8c61\u4e2d<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ConfigurationPropertySources.attach(environment);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;4\u3001\u901a\u77e5\u76d1\u542c\u5668\u73af\u5883\u53c2\u6570\u5df2\u7ecf\u51c6\u5907\u5c31\u7eea<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listeners.environmentPrepared(bootstrapContext,&nbsp;environment);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;5\u3001\u5c06\u9ed8\u8ba4\u7684\u5c5e\u6027\u6e90\u4e2d\u7684\u6240\u6709\u5c5e\u6027\u503c\u79fb\u5230\u73af\u5883\u5bf9\u8c61\u7684\u961f\u5217\u672b\u5c3e\uff0c<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u8fd9\u6837\u7528\u6237\u81ea\u5b9a\u4e49\u7684\u5c5e\u6027\u503c\u5c31\u53ef\u4ee5\u8986\u76d6\u9ed8\u8ba4\u7684\u5c5e\u6027\u503c\u3002\u8fd9\u662f\u4e3a\u4e86\u907f\u514d\u7528\u6237\u65e0\u610f\u4e2d\u8986\u76d6\u4e86&nbsp;Spring&nbsp;Boot&nbsp;\u6240\u63d0\u4f9b\u7684\u9ed8\u8ba4\u5c5e\u6027\u3002<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DefaultPropertiesPropertySource.moveToEnd(environment);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Assert.state(!environment.containsProperty(<span style=\"color: #98c379;line-height: 26px;\">\"spring.main.environment-prefix\"<\/span>),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"Environment&nbsp;prefix&nbsp;cannot&nbsp;be&nbsp;set&nbsp;via&nbsp;properties.\"<\/span>);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;6\u3001\u5c06&nbsp;Spring&nbsp;Boot&nbsp;\u5e94\u7528\u7a0b\u5e8f\u7684\u5c5e\u6027\u7ed1\u5b9a\u5230\u73af\u5883\u5bf9\u8c61\u4e0a\uff0c\u4ee5\u4fbf\u80fd\u591f\u6b63\u786e\u5730\u8bfb\u53d6\u548c\u4f7f\u7528\u8fd9\u4e9b\u914d\u7f6e\u5c5e\u6027<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bindToSpringApplication(environment);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;7\u3001\u5982\u679c\u6ca1\u6709\u81ea\u5b9a\u4e49\u7684\u73af\u5883\u7c7b\u578b\uff0c\u5219\u4f7f\u7528&nbsp;EnvironmentConverter&nbsp;\u7c7b\u578b\u5c06\u73af\u5883\u5bf9\u8c61\u8f6c\u6362\u4e3a\u6807\u51c6\u7684\u73af\u5883\u7c7b\u578b\uff0c\u5e76\u6dfb\u52a0\u5230&nbsp;ConfigurableEnvironment&nbsp;\u5bf9\u8c61\u4e2d\u3002<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(!<span style=\"color: #c678dd;line-height: 26px;\">this<\/span>.isCustomEnvironment)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EnvironmentConverter&nbsp;environmentConverter&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;EnvironmentConverter(getClassLoader());<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;environment&nbsp;=&nbsp;environmentConverter.convertEnvironmentIfNecessary(environment,&nbsp;deduceEnvironmentClass());<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;8\u3001\u518d\u6b21\u52a0\u8f7d\u7cfb\u7edf\u914d\u7f6e\uff0c\u4ee5\u9632\u6b62\u88ab\u5176\u4ed6\u914d\u7f6e\u8986\u76d6<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ConfigurationPropertySources.attach(environment);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;environment;<br>}<br><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u770b\u770b\u5b83\u7684\u914d\u7f6e\u52a0\u8f7d\u6d41\u7a0b\u6b65\u9aa4\uff1a<\/p>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    \u521b\u5efa <strong style=\"color: rgb(9, 142, 252);\">\u73af\u5883\u5bf9\u8c61<\/strong> <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(248, 35, 35);\">ConfigurableEnvironment<\/code> \u7528\u4e8e\u5b58\u50a8\u73af\u5883\u53c2\u6570\uff1b<br \/>\n   <\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <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(248, 35, 35);\">configureEnvironment<\/code> \u65b9\u6cd5\u52a0\u8f7d\u9ed8\u8ba4\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(248, 35, 35);\">application.properties<\/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(248, 35, 35);\">application.yml<\/code> \u914d\u7f6e\u6587\u4ef6\uff1b\u4ee5\u53ca\u7528\u6237\u6307\u5b9a\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5c06\u5176\u5c01\u88c5\u4e3a <strong style=\"color: rgb(9, 142, 252);\">PropertySource<\/strong> \u6dfb\u52a0\u5230\u73af\u5883\u5bf9\u8c61\u4e2d\uff1b<br \/>\n   <\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <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(248, 35, 35);\">attach()<\/code>\uff1a \u52a0\u8f7d\u6240\u6709\u7684\u7cfb\u7edf\u5c5e\u6027\uff0c\u5e76\u5c06\u5b83\u4eec\u6dfb\u52a0\u5230\u73af\u5883\u5bf9\u8c61\u4e2d\uff1b<br \/>\n   <\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <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(248, 35, 35);\">listeners.environmentPrepared()<\/code>\uff1a \u53d1\u9001\u73af\u5883\u53c2\u6570\u914d\u7f6e\u5df2\u7ecf\u51c6\u5907\u5c31\u7eea\u7684\u76d1\u542c\u901a\u77e5\uff1b<br \/>\n   <\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <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(248, 35, 35);\">moveToEnd()<\/code>\uff1a \u5c06 <strong style=\"color: rgb(9, 142, 252);\">\u7cfb\u7edf\u9ed8\u8ba4<\/strong> \u7684\u5c5e\u6027\u6e90\u4e2d\u7684\u6240\u6709\u5c5e\u6027\u503c\u79fb\u5230\u73af\u5883\u5bf9\u8c61\u7684\u961f\u5217\u672b\u5c3e\uff0c\u8fd9\u6837\u7528\u6237\u81ea\u5b9a\u4e49\u7684\u5c5e\u6027\u503c\u5c31\u53ef\u4ee5\u8986\u76d6\u9ed8\u8ba4\u7684\u5c5e\u6027\u503c\u3002<br \/>\n   <\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <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(248, 35, 35);\">bindToSpringApplication<\/code>\uff1a \u5e94\u7528\u7a0b\u5e8f\u7684\u5c5e\u6027\u7ed1\u5b9a\u5230 Bean \u5bf9\u8c61\u4e0a\uff1b<br \/>\n   <\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <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(248, 35, 35);\">attach()<\/code>\uff1a \u518d\u6b21\u52a0\u8f7d\u7cfb\u7edf\u914d\u7f6e\uff0c\u4ee5\u9632\u6b62\u88ab\u5176\u4ed6\u914d\u7f6e\u8986\u76d6\uff1b<br \/>\n   <\/section>\n<\/li>\n<\/ul>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u4e0a\u8fb9\u7684\u914d\u7f6e\u52a0\u8f7d\u6d41\u7a0b\u4e2d\uff0c\u5404\u79cd\u914d\u7f6e\u5c5e\u6027\u4f1a\u5c01\u88c5\u6210\u4e00\u4e2a\u4e2a\u62bd\u8c61\u7684\u6570\u636e\u7ed3\u6784 <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(248, 35, 35);\">PropertySource<\/code>\u4e2d\uff0c\u8fd9\u4e2a\u6570\u636e\u7ed3\u6784\u4ee3\u7801\u683c\u5f0f\u5982\u4e0b\uff0ckey-value\u5f62\u5f0f\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.6296306390890973&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><br><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">abstract<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">PropertySource<\/span>&lt;<span style=\"color: #e6c07b;line-height: 26px;\">T<\/span>&gt;&nbsp;<\/span>{<br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">protected<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">final<\/span>&nbsp;String&nbsp;name;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u5c5e\u6027\u6e90\u540d\u79f0<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">protected<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">final<\/span>&nbsp;T&nbsp;source;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u5c5e\u6027\u6e90\u503c\uff08\u4e00\u4e2a\u6cdb\u578b\uff0c\u6bd4\u5982Map\uff0cProperty\uff09<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;String&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">getName<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u83b7\u53d6\u5c5e\u6027\u6e90\u7684\u540d\u5b57&nbsp;&nbsp;<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;T&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">getSource<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u83b7\u53d6\u5c5e\u6027\u6e90\u503c&nbsp;&nbsp;<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">boolean<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">containsProperty<\/span><span style=\"line-height: 26px;\">(String&nbsp;name)<\/span><\/span>;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u662f\u5426\u5305\u542b\u67d0\u4e2a\u5c5e\u6027&nbsp;&nbsp;<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">abstract<\/span>&nbsp;Object&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">getProperty<\/span><span style=\"line-height: 26px;\">(String&nbsp;name)<\/span><\/span>;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u5f97\u5230\u5c5e\u6027\u540d\u5bf9\u5e94\u7684\u5c5e\u6027\u503c&nbsp;&nbsp;&nbsp;<\/span><br>}&nbsp;<br><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\"><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(248, 35, 35);\">PropertySource<\/code> \u6709\u8bf8\u591a\u7684\u5b9e\u73b0\u7c7b\u7528\u4e8e\u7ba1\u7406\u5e94\u7528\u7a0b\u5e8f\u7684\u914d\u7f6e\u5c5e\u6027\u3002\u4e0d\u540c\u7684 PropertySource \u5b9e\u73b0\u7c7b\u53ef\u4ee5\u4ece\u4e0d\u540c\u7684\u6765\u6e90\u83b7\u53d6\u914d\u7f6e\u5c5e\u6027\uff0c\u4f8b\u5982\u6587\u4ef6\u3001\u73af\u5883\u53d8\u91cf\u3001\u547d\u4ee4\u884c\u53c2\u6570\u7b49\u3002\u5176\u4e2d\u6d89\u53ca\u5230\u7684\u4e00\u4e9b\u5b9e\u73b0\u7c7b\u6709\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;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.45552884615384615\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-01\/20230714172801b0b057ab4.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-type=\"png\" data-w=\"832\" style=\"display: block;margin-right: auto;margin-left: auto;height: auto !important;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.45552884615384615\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-01\/20230714172801b0b057ab4.png\" data-type=\"png\" data-w=\"832\" style=\"display: block;margin-right: auto;margin-left: auto;height: auto !important;\"><\/noscript><figcaption style=\"margin-top: 5px;text-align: center;color: #888;font-size: 14px;\">\n   \u5173\u7cfb\u56fe<br \/>\n  <\/figcaption><\/figure>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <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(248, 35, 35);\">MapPropertySource<\/code>: Map \u952e\u503c\u5bf9\u7684\u5bf9\u8c61\u8f6c\u6362\u4e3a PropertySource \u5bf9\u8c61\u7684\u9002\u914d\u5668\uff1b<br \/>\n   <\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <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(248, 35, 35);\">PropertiesPropertySource<\/code>: Properties \u5bf9\u8c61\u4e2d\u7684\u6240\u6709\u914d\u7f6e\u5c5e\u6027\u8f6c\u6362\u4e3a Spring \u73af\u5883\u4e2d\u7684\u5c5e\u6027\u503c\uff1b<br \/>\n   <\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <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(248, 35, 35);\">ResourcePropertySource<\/code>: \u4ece\u6587\u4ef6\u7cfb\u7edf\u6216\u8005 classpath \u4e2d\u52a0\u8f7d\u914d\u7f6e\u5c5e\u6027\uff0c\u5c01\u88c5\u6210 PropertySource\u5bf9\u8c61\uff1b<br \/>\n   <\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <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(248, 35, 35);\">ServletConfigPropertySource<\/code>: Servlet \u914d\u7f6e\u4e2d\u8bfb\u53d6\u914d\u7f6e\u5c5e\u6027\uff0c\u5c01\u88c5\u6210 PropertySource \u5bf9\u8c61\uff1b<br \/>\n   <\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <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(248, 35, 35);\">ServletContextPropertySource<\/code>: Servlet \u4e0a\u4e0b\u6587\u4e2d\u8bfb\u53d6\u914d\u7f6e\u5c5e\u6027\uff0c\u5c01\u88c5\u6210 PropertySource \u5bf9\u8c61\uff1b<br \/>\n   <\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <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(248, 35, 35);\">StubPropertySource<\/code>: \u662f\u4e2a\u7a7a\u7684\u5b9e\u73b0\u7c7b\uff0c\u5b83\u7684\u4f5c\u7528\u4ec5\u4ec5\u662f\u7ed9 CompositePropertySource \u7c7b\u4f5c\u4e3a\u9ed8\u8ba4\u7684\u7236\u7ea7\u5c5e\u6027\u6e90\uff0c\u4ee5\u907f\u514d\u7a7a\u6307\u9488\u5f02\u5e38\uff1b<br \/>\n   <\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <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(248, 35, 35);\">CompositePropertySource<\/code>: \u662f\u4e2a\u590d\u5408\u578b\u7684\u5b9e\u73b0\u7c7b\uff0c\u5185\u90e8\u7ef4\u62a4\u4e86 PropertySource\u96c6\u5408\u961f\u5217\uff0c\u53ef\u4ee5\u5c06\u591a\u4e2a PropertySource \u5bf9\u8c61\u5408\u5e76\uff1b<br \/>\n   <\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <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(248, 35, 35);\">SystemEnvironmentPropertySource<\/code>: \u64cd\u4f5c\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\u8bfb\u53d6\u914d\u7f6e\u5c5e\u6027\uff0c\u5c01\u88c5\u6210 PropertySource \u5bf9\u8c61\uff1b<br \/>\n   <\/section>\n<\/li>\n<\/ul>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u4e0a\u8fb9\u5404\u7c7b\u914d\u7f6e\u521d\u59cb\u5316\u751f\u6210\u7684 PropertySource \u5bf9\u8c61\u4f1a\u88ab\u7ef4\u62a4\u5230\u96c6\u5408\u961f\u5217\u4e2d\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.19521422035768565&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\">List&lt;PropertySource&lt;?&gt;&gt;&nbsp;sources&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;ArrayList&lt;PropertySource&lt;?&gt;&gt;()<br><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u914d\u7f6e\u521d\u59cb\u5316\u5b8c\u6bd5\uff0c\u5e94\u7528\u7a0b\u5e8f\u4e0a\u4e0b\u6587<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(248, 35, 35);\">AbstractApplicationContext<\/code>\u4f1a\u52a0\u8f7d\u914d\u7f6e\uff0c\u8fd9\u6837\u7a0b\u5e8f\u5728\u8fd0\u884c\u65f6\u5c31\u53ef\u4ee5\u968f\u65f6\u83b7\u53d6\u914d\u7f6e\u4fe1\u606f\u4e86\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.8627604171082106&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\">&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">prepareContext<\/span><span style=\"line-height: 26px;\">(DefaultBootstrapContext&nbsp;bootstrapContext,&nbsp;ConfigurableApplicationContext&nbsp;context,<br>&nbsp;&nbsp;&nbsp;ConfigurableEnvironment&nbsp;environment,&nbsp;SpringApplicationRunListeners&nbsp;listeners,<br>&nbsp;&nbsp;&nbsp;ApplicationArguments&nbsp;applicationArguments,&nbsp;Banner&nbsp;printedBanner)<\/span>&nbsp;<\/span>{<br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u5e94\u7528\u4e0a\u4e0b\u6587\u52a0\u8f7d\u73af\u5883\u5bf9\u8c61<\/span><br>&nbsp;&nbsp;context.setEnvironment(environment);<br>&nbsp;&nbsp;postProcessApplicationContext(context);<br>&nbsp;&nbsp;&nbsp;&nbsp;.........<br>&nbsp;&nbsp;}<br><\/code><\/pre>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;font-size: 20px;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span>3\u3001\u8bfb\u53d6\u914d\u7f6e<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u770b\u660e\u767d\u4e0a\u8fb9\u914d\u7f6e\u52a0\u8f7d\u7684\u6d41\u7a0b\uff0c\u5176\u5b9e\u8bfb\u53d6\u914d\u7f6e\u5c31\u5bb9\u6613\u7406\u89e3\u4e86\uff0c\u65e0\u975e\u5c31\u662f\u904d\u5386\u961f\u5217\u91cc\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(248, 35, 35);\">PropertySource<\/code>\uff0c\u62ff\u5c5e\u6027\u540d\u79f0<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(248, 35, 35);\">name<\/code>\u5339\u914d\u5bf9\u5e94\u7684\u5c5e\u6027\u503c<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(248, 35, 35);\">source<\/code>\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\"><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(248, 35, 35);\">PropertyResolver<\/code>\u662f\u83b7\u53d6\u914d\u7f6e\u7684\u5173\u952e\u7c7b\uff0c\u5176\u5185\u90e8\u63d0\u4f9b\u4e86\u64cd\u4f5c<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(248, 35, 35);\">PropertySource<\/code> \u961f\u5217\u7684\u65b9\u6cd5\uff0c\u6838\u5fc3\u65b9\u6cd5<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(248, 35, 35);\">getProperty(key)<\/code>\u83b7\u53d6\u914d\u7f6e\u503c\uff0c\u770b\u4e86\u4e0b\u8fd9\u4e2a\u7c7b\u7684\u4f9d\u8d56\u5173\u7cfb\uff0c\u53d1\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(248, 35, 35);\">Environment<\/code> \u662f\u5b83\u5b50\u7c7b\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;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"1.0374220374220373\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-02\/20230714172802eaead6f3f.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-type=\"png\" data-w=\"481\" style=\"display: block;margin-right: auto;margin-left: auto;height: auto !important;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"1.0374220374220373\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-02\/20230714172802eaead6f3f.png\" data-type=\"png\" data-w=\"481\" style=\"display: block;margin-right: auto;margin-left: auto;height: auto !important;\"><\/noscript><br \/>\n <\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u90a3\u4e48\u76f4\u63a5\u7528 PropertyResolver \u6765\u83b7\u53d6\u914d\u7f6e\u5c5e\u6027\u5176\u5b9e\u4e5f\u662f\u53ef\u4ee5\u7684\uff0c\u5230\u8fd9\u6211\u4eec\u5c31\u5927\u81f4\u660e\u767d\u4e86 Springboot \u914d\u7f6e\u7684\u52a0\u8f7d\u548c\u8bfb\u53d6\u4e86\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.49934305492551845&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@Slf<\/span>4j<br><span style=\"color: #61aeee;line-height: 26px;\">@SpringBootTest<\/span><br><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">EnvironmentTest<\/span>&nbsp;<\/span>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Resource<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;PropertyResolver&nbsp;env;<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Test<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">var1Test<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<\/span>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;var1&nbsp;=&nbsp;env.getProperty(<span style=\"color: #98c379;line-height: 26px;\">\"env101.var1\"<\/span>);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log.info(<span style=\"color: #98c379;line-height: 26px;\">\"Environment&nbsp;\u914d\u7f6e\u83b7\u53d6&nbsp;{}\"<\/span>,&nbsp;var1);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><\/code><\/pre>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;border-bottom: 2px solid rgb(9, 142, 252);font-size: 1.3em;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span><span style=\"display: inline-block;background: rgb(9, 142, 252);color: rgb(255, 255, 255);padding: 3px 10px 1px;border-top-right-radius: 3px;border-top-left-radius: 3px;margin-right: 3px;\">\u4e8c\u3001@Value \u6ce8\u89e3<\/span><span style=\"display: inline-block;vertical-align: bottom;border-bottom: 36px solid #efebe9;border-right: 20px solid transparent;\"> <\/span><\/h2>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">@Value\u6ce8\u89e3\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(248, 35, 35);\">Spring<\/code>\u6846\u67b6\u63d0\u4f9b\u7684\u7528\u4e8e\u6ce8\u5165\u914d\u7f6e\u5c5e\u6027\u503c\u7684\u6ce8\u89e3\uff0c\u5b83\u53ef\u7528\u4e8e\u7c7b\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(248, 35, 35);\">\u6210\u5458\u53d8\u91cf<\/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(248, 35, 35);\">\u65b9\u6cd5\u53c2\u6570<\/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(248, 35, 35);\">\u6784\u9020\u51fd\u6570<\/code>\u53c2\u6570\u4e0a\uff0c<strong style=\"color: rgb(9, 142, 252);\">\u8fd9\u4e2a\u8bb0\u4f4f\u5f88\u91cd\u8981\uff01<\/strong><\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u5728\u5e94\u7528\u7a0b\u5e8f\u542f\u52a8\u65f6\uff0c\u4f7f\u7528 @Value \u6ce8\u89e3\u7684 Bean \u4f1a\u88ab\u5b9e\u4f8b\u5316\u3002\u6240\u6709\u4f7f\u7528\u4e86 @Value \u6ce8\u89e3\u7684 Bean \u4f1a\u88ab\u52a0\u5165\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(248, 35, 35);\">PropertySourcesPlaceholderConfigurer<\/code> \u7684\u540e\u7f6e\u5904\u7406\u5668\u96c6\u5408\u4e2d\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u5f53\u540e\u7f6e\u5904\u7406\u5668\u5f00\u59cb\u6267\u884c\u65f6\uff0c\u5b83\u4f1a\u8bfb\u53d6 Bean \u4e2d\u6240\u6709 @Value \u6ce8\u89e3\u6240\u6807\u6ce8\u7684\u503c\uff0c\u5e76\u901a\u8fc7\u53cd\u5c04\u5c06\u89e3\u6790\u540e\u7684\u5c5e\u6027\u503c\u8d4b\u503c\u7ed9\u6807\u6709 @Value \u6ce8\u89e3\u7684\u6210\u5458\u53d8\u91cf\u3001\u65b9\u6cd5\u53c2\u6570\u548c\u6784\u9020\u51fd\u6570\u53c2\u6570\u3002<\/p>\n<blockquote data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"border-top: none;border-right: none;border-bottom: none;font-size: 0.9em;overflow: auto;color: rgb(106, 115, 125);padding: 10px 10px 10px 20px;margin-bottom: 20px;margin-top: 20px;border-left-color: rgb(239, 112, 96);background: rgb(255, 249, 249);\">\n<p style=\"font-size: 16px;padding-top: 8px;padding-bottom: 8px;word-spacing: 1.8px;letter-spacing: 1.2px;color: black;line-height: 26px;\">\u9700\u8981\u6ce8\u610f\uff0c\u5728\u4f7f\u7528 @Value \u6ce8\u89e3\u65f6\u9700\u8981\u786e\u4fdd\u6ce8\u5165\u7684\u5c5e\u6027\u503c\u5df2\u7ecf\u52a0\u8f7d\u5230 Spring \u5bb9\u5668\u4e2d\uff0c\u5426\u5219\u4f1a\u5bfc\u81f4\u6ce8\u5165\u5931\u8d25\u3002<\/p>\n<\/blockquote>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;font-size: 20px;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span>\u5982\u4f55\u4f7f\u7528<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\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(248, 35, 35);\">src\/main\/resources<\/code>\u76ee\u5f55\u4e0b\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(248, 35, 35);\">application.yml<\/code>\u914d\u7f6e\u6587\u4ef6\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(248, 35, 35);\">env101.var1<\/code>\u5c5e\u6027\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.09759615411239286&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\">env101:<br>&nbsp;&nbsp;var1:&nbsp;var1-\u516c\u4f17\u53f7\uff1a\u7a0b\u5e8f\u5458\u5c0f\u5bcc<br><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u53ea\u8981\u5728\u53d8\u91cf\u4e0a\u52a0\u6ce8\u89e3 <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(248, 35, 35);\">@Value(\"${env101.var1}\")<\/code>\u5c31\u53ef\u4ee5\u4e86\uff0c@Value \u6ce8\u89e3\u4f1a\u81ea\u52a8\u5c06\u914d\u7f6e\u6587\u4ef6\u4e2d\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(248, 35, 35);\">env101.var1<\/code>\u5c5e\u6027\u503c\u6ce8\u5165\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(248, 35, 35);\">var1<\/code>\u5b57\u6bb5\u4e2d\uff0c\u8dd1\u4e2a\u5355\u5143\u6d4b\u8bd5\u770b\u4e00\u4e0b\u7ed3\u679c\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.027184174332922195&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@Slf<\/span>4j<br><span style=\"color: #61aeee;line-height: 26px;\">@SpringBootTest<\/span><br><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">EnvVariablesTest<\/span>&nbsp;<\/span>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Value<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"${env101.var1}\"<\/span>)<br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;String&nbsp;var1;<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Test<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">var1Test<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log.info(<span style=\"color: #98c379;line-height: 26px;\">\"\u914d\u7f6e\u6587\u4ef6\u5c5e\u6027:&nbsp;{}\"<\/span>,var1);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u6beb\u65e0\u60ac\u5ff5\uff0c\u6210\u529f\u62ff\u5230\u914d\u7f6e\u6570\u636e\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;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.04814814814814815\" data-type=\"png\" data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;height: auto !important;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-02\/202307141728027f7f2a433.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-ratio=\"0.04814814814814815\" data-type=\"png\" data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;height: auto !important;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-02\/202307141728027f7f2a433.png\"><\/noscript><br \/>\n <\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u867d\u7136@Value\u6ce8\u89e3\u65b9\u5f0f\u4f7f\u7528\u8d77\u6765\u5f88\u7b80\u5355\uff0c\u5982\u679c\u4f7f\u7528\u4e0d\u5f53\u8fd8\u4f1a\u9047\u5230\u4e0d\u5c11\u5751\u3002<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;font-size: 20px;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span>1\u3001\u7f3a\u5931\u914d\u7f6e<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u5982\u679c\u5728\u4ee3\u7801\u4e2d\u5f15\u7528\u53d8\u91cf\uff0c\u914d\u7f6e\u6587\u4ef6\u4e2d\u672a\u8fdb\u884c\u914d\u503c\uff0c\u5c31\u4f1a\u51fa\u73b0\u7c7b\u4f3c\u4e0b\u56fe\u6240\u793a\u7684\u9519\u8bef\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;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.13518518518518519\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-02\/20230714172802373749178.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-type=\"png\" data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;height: auto !important;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.13518518518518519\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-02\/20230714172802373749178.png\" data-type=\"png\" data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;height: auto !important;\"><\/noscript><br \/>\n <\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u4e3a\u4e86\u907f\u514d\u6b64\u7c7b\u9519\u8bef\u5bfc\u81f4\u670d\u52a1\u542f\u52a8\u5f02\u5e38\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u5f15\u7528\u53d8\u91cf\u7684\u540c\u65f6\u7ed9\u5b83\u8d4b\u4e00\u4e2a\u9ed8\u8ba4\u503c\uff0c\u4ee5\u786e\u4fdd\u5373\u4f7f\u5728\u672a\u6b63\u786e\u914d\u503c\u7684\u60c5\u51b5\u4e0b\uff0c\u7a0b\u5e8f\u4f9d\u7136\u80fd\u591f\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.7350558599027133&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@Value<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"${env101.var1:\u6211\u662f\u5c0f\u5bcc}\"<\/span>)<br><span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;String&nbsp;var1;<br><\/code><\/pre>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;font-size: 20px;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span>2\u3001\u9759\u6001\u53d8\u91cf\uff08static\uff09\u8d4b\u503c<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u8fd8\u6709\u4e00\u79cd\u5e38\u89c1\u7684\u4f7f\u7528\u8bef\u533a\uff0c\u5c31\u662f\u5c06 @Value \u6ce8\u89e3\u52a0\u5230\u9759\u6001\u53d8\u91cf\u4e0a\uff0c\u8fd9\u6837\u505a\u662f\u65e0\u6cd5\u83b7\u53d6\u5c5e\u6027\u503c\u7684\u3002\u9759\u6001\u53d8\u91cf\u662f\u7c7b\u7684\u5c5e\u6027\uff0c\u5e76\u4e0d\u5c5e\u4e8e\u5bf9\u8c61\u7684\u5c5e\u6027\uff0c\u800c Spring\u662f\u57fa\u4e8e\u5bf9\u8c61\u7684\u5c5e\u6027\u8fdb\u884c\u4f9d\u8d56\u6ce8\u5165\u7684\uff0c\u7c7b\u5728\u5e94\u7528\u542f\u52a8\u65f6\u9759\u6001\u53d8\u91cf\u5c31\u88ab\u521d\u59cb\u5316\uff0c\u6b64\u65f6 Bean\u8fd8\u672a\u88ab\u5b9e\u4f8b\u5316\uff0c\u56e0\u6b64\u4e0d\u53ef\u80fd\u901a\u8fc7 @Value \u6ce8\u5165\u5c5e\u6027\u503c\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.9478467843385596&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@Slf<\/span>4j<br><span style=\"color: #61aeee;line-height: 26px;\">@SpringBootTest<\/span><br><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">EnvVariablesTest<\/span>&nbsp;<\/span>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Value<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"${env101.var1}\"<\/span>)<br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">static<\/span>&nbsp;String&nbsp;var1;<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Test<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">var1Test<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log.info(<span style=\"color: #98c379;line-height: 26px;\">\"\u914d\u7f6e\u6587\u4ef6\u5c5e\u6027:&nbsp;{}\"<\/span>,var1);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u5373\u4f7f @Value \u6ce8\u89e3\u65e0\u6cd5\u76f4\u63a5\u7528\u5728\u9759\u6001\u53d8\u91cf\u4e0a\uff0c\u6211\u4eec\u4ecd\u7136\u53ef\u4ee5\u901a\u8fc7\u83b7\u53d6\u5df2\u6709 Bean\u5b9e\u4f8b\u5316\u540e\u7684\u5c5e\u6027\u503c\uff0c\u518d\u5c06\u5176\u8d4b\u503c\u7ed9\u9759\u6001\u53d8\u91cf\u6765\u5b9e\u73b0\u7ed9\u9759\u6001\u53d8\u91cf\u8d4b\u503c\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u6211\u4eec\u53ef\u4ee5\u5148\u901a\u8fc7 @Value \u6ce8\u89e3\u5c06\u5c5e\u6027\u503c\u6ce8\u5165\u5230\u666e\u901a Bean\u4e2d\uff0c\u7136\u540e\u5728\u83b7\u53d6\u8be5 Bean\u5bf9\u5e94\u7684\u5c5e\u6027\u503c\uff0c\u5e76\u5c06\u5176\u8d4b\u503c\u7ed9\u9759\u6001\u53d8\u91cf\u3002\u8fd9\u6837\uff0c\u5c31\u53ef\u4ee5\u5728\u9759\u6001\u53d8\u91cf\u4e2d\u4f7f\u7528\u8be5\u5c5e\u6027\u503c\u4e86\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.8898292394614411&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@Slf<\/span>4j<br><span style=\"color: #61aeee;line-height: 26px;\">@SpringBootTest<\/span><br><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">EnvVariablesTest<\/span>&nbsp;<\/span>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">static<\/span>&nbsp;String&nbsp;var3;<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">static<\/span>&nbsp;String&nbsp;var4;<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Value<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"${env101.var3}\"<\/span>)<br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">setVar3<\/span><span style=\"line-height: 26px;\">(String&nbsp;var3)<\/span>&nbsp;<\/span>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var3&nbsp;=&nbsp;var3;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;EnvVariablesTest(<span style=\"color: #61aeee;line-height: 26px;\">@Value<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"${env101.var4}\"<\/span>)&nbsp;String&nbsp;var4){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var4&nbsp;=&nbsp;var4;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">static<\/span>&nbsp;String&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">getVar4<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<\/span>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;var4;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">static<\/span>&nbsp;String&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">getVar3<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<\/span>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;var3;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><\/code><\/pre>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;font-size: 20px;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span>3\u3001\u5e38\u91cf\uff08final\uff09\u8d4b\u503c<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">@Value \u6ce8\u89e3\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(248, 35, 35);\">final<\/code>\u5173\u952e\u5b57\u4e0a\u540c\u6837\u4e5f\u65e0\u6cd5\u83b7\u53d6\u5c5e\u6027\u503c\uff0c\u56e0\u4e3a final \u53d8\u91cf\u5fc5\u987b\u5728\u6784\u9020\u65b9\u6cd5\u4e2d\u8fdb\u884c\u521d\u59cb\u5316\uff0c\u5e76\u4e14\u4e00\u65e6\u88ab\u8d4b\u503c\u4fbf\u4e0d\u80fd\u518d\u6b21\u66f4\u6539\u3002\u800c @Value \u6ce8\u89e3\u662f\u5728 bean \u5b9e\u4f8b\u5316\u4e4b\u540e\u624d\u8fdb\u884c\u5c5e\u6027\u6ce8\u5165\u7684\uff0c\u56e0\u6b64\u65e0\u6cd5\u5728\u6784\u9020\u65b9\u6cd5\u4e2d\u521d\u59cb\u5316 final \u53d8\u91cf\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.5008904418639075&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@Slf<\/span>4j<br><span style=\"color: #61aeee;line-height: 26px;\">@SpringBootTest<\/span><br><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">EnvVariables2Test<\/span>&nbsp;<\/span>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">final<\/span>&nbsp;String&nbsp;var6;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Autowired<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;EnvVariables2Test(&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Value<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"${env101.var6}\"<\/span>)&nbsp;&nbsp;String&nbsp;var6)&nbsp;{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">this<\/span>.var6&nbsp;=&nbsp;var6;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@value<\/span>\u6ce8\u89e3&nbsp;final&nbsp;\u83b7\u53d6<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Test<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">var1Test<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<\/span>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log.info(<span style=\"color: #98c379;line-height: 26px;\">\"final&nbsp;\u6ce8\u5165:&nbsp;{}\"<\/span>,&nbsp;var6);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><\/code><\/pre>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;font-size: 20px;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span>4\u3001\u975e\u6ce8\u518c\u7684\u7c7b\u4e2d\u4f7f\u7528<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u53ea\u6709\u6807\u6ce8\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(248, 35, 35);\">@Component<\/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(248, 35, 35);\">@Service<\/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(248, 35, 35);\">@Controller<\/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(248, 35, 35);\">@Repository<\/code> \u6216 <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(248, 35, 35);\">@Configuration<\/code> \u7b49<strong style=\"color: rgb(9, 142, 252);\">\u5bb9\u5668\u7ba1\u7406<\/strong>\u6ce8\u89e3\u7684\u7c7b\uff0c\u7531 Spring \u7ba1\u7406\u7684 bean \u4e2d\u4f7f\u7528 @Value\u6ce8\u89e3\u624d\u4f1a\u751f\u6548\u3002\u800c\u5bf9\u4e8e\u666e\u901a\u7684POJO\u7c7b\uff0c\u5219\u65e0\u6cd5\u4f7f\u7528 @Value\u6ce8\u89e3\u8fdb\u884c\u5c5e\u6027\u6ce8\u5165\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.014980003303274536&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/**<br>&nbsp;*&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@value<\/span>\u6ce8\u89e3&nbsp;\u975e\u6ce8\u518c\u7684\u7c7b\u4e2d\u4f7f\u7528<br>&nbsp;*&nbsp;`<span style=\"color: #c678dd;line-height: 26px;\">@Component<\/span>`\u3001`<span style=\"color: #c678dd;line-height: 26px;\">@Service<\/span>`\u3001`<span style=\"color: #c678dd;line-height: 26px;\">@Controller<\/span>`\u3001`<span style=\"color: #c678dd;line-height: 26px;\">@Repository<\/span>`&nbsp;\u6216&nbsp;`<span style=\"color: #c678dd;line-height: 26px;\">@Configuration<\/span>`&nbsp;\u7b49<br>&nbsp;*&nbsp;\u5bb9\u5668\u7ba1\u7406\u6ce8\u89e3\u7684\u7c7b\u4e2d\u4f7f\u7528&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@Value<\/span>\u6ce8\u89e3\u624d\u4f1a\u751f\u6548<br>&nbsp;*\/<\/span><br><span style=\"color: #61aeee;line-height: 26px;\">@Data<\/span><br><span style=\"color: #61aeee;line-height: 26px;\">@Slf<\/span>4j<br><span style=\"color: #61aeee;line-height: 26px;\">@Component<\/span><br><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">TestService<\/span>&nbsp;<\/span>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Value<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"${env101.var7}\"<\/span>)<br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;String&nbsp;var7;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;String&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">getVar7<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">this<\/span>.var7;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><\/code><\/pre>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;font-size: 20px;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span>5\u3001\u5f15\u7528\u65b9\u5f0f\u4e0d\u5bf9<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u5982\u679c\u6211\u4eec\u60f3\u8981\u83b7\u53d6 TestService \u7c7b\u4e2d\u7684\u67d0\u4e2a\u53d8\u91cf\u7684\u5c5e\u6027\u503c\uff0c\u9700\u8981\u4f7f\u7528\u4f9d\u8d56\u6ce8\u5165\u7684\u65b9\u5f0f\uff0c\u800c\u4e0d\u80fd\u4f7f\u7528 new \u7684\u65b9\u5f0f\u3002\u901a\u8fc7\u4f9d\u8d56\u6ce8\u5165\u7684\u65b9\u5f0f\u521b\u5efa TestService \u5bf9\u8c61\uff0cSpring \u4f1a\u5728\u521b\u5efa\u5bf9\u8c61\u65f6\u5c06\u5bf9\u8c61\u6240\u9700\u7684\u5c5e\u6027\u503c\u6ce8\u5165\u5230\u5176\u4e2d\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.28188750696136466&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><br>&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/**<br>&nbsp;&nbsp;&nbsp;*&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@value<\/span>\u6ce8\u89e3&nbsp;\u5f15\u7528\u65b9\u5f0f\u4e0d\u5bf9<br>&nbsp;&nbsp;&nbsp;*\/<\/span><br>&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Test<\/span><br>&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">var7_1Test<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<\/span>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TestService&nbsp;testService&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;TestService();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log.info(<span style=\"color: #98c379;line-height: 26px;\">\"\u5f15\u7528\u65b9\u5f0f\u4e0d\u5bf9&nbsp;\u6ce8\u5165:&nbsp;{}\"<\/span>,&nbsp;testService.getVar7());<br>&nbsp;&nbsp;}<br><\/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;color: rgb(106, 115, 125);padding: 10px 10px 10px 20px;margin-bottom: 20px;margin-top: 20px;border-left-color: rgb(239, 112, 96);background: rgb(255, 249, 249);\">\n<p style=\"font-size: 16px;padding-top: 8px;padding-bottom: 8px;word-spacing: 1.8px;letter-spacing: 1.2px;color: black;line-height: 26px;\">\u6700\u540e\u603b\u7ed3\u4e00\u4e0b <strong style=\"color: rgb(9, 142, 252);\">@Value\u6ce8\u89e3\u8981\u5728 Bean\u7684\u751f\u547d\u5468\u671f\u5185\u4f7f\u7528\u624d\u80fd\u751f\u6548\u3002<\/strong><\/p>\n<\/blockquote>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;border-bottom: 2px solid rgb(9, 142, 252);font-size: 1.3em;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span><span style=\"display: inline-block;background: rgb(9, 142, 252);color: rgb(255, 255, 255);padding: 3px 10px 1px;border-top-right-radius: 3px;border-top-left-radius: 3px;margin-right: 3px;\">\u4e09\u3001@ConfigurationProperties \u6ce8\u89e3<\/span><span style=\"display: inline-block;vertical-align: bottom;border-bottom: 36px solid #efebe9;border-right: 20px solid transparent;\"> <\/span><\/h2>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\"><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(248, 35, 35);\">@ConfigurationProperties<\/code>\u6ce8\u89e3\u662f SpringBoot \u63d0\u4f9b\u7684\u4e00\u79cd\u66f4\u52a0\u4fbf\u6377\u6765\u5904\u7406\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u5c5e\u6027\u503c\u7684\u65b9\u5f0f\uff0c\u53ef\u4ee5\u901a\u8fc7\u81ea\u52a8\u7ed1\u5b9a\u548c\u7c7b\u578b\u8f6c\u6362\u7b49\u673a\u5236\uff0c\u5c06\u6307\u5b9a\u524d\u7f00\u7684\u5c5e\u6027\u96c6\u5408\u81ea\u52a8\u7ed1\u5b9a\u5230\u4e00\u4e2aBean\u5bf9\u8c61\u4e0a\u3002<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;font-size: 20px;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span>\u52a0\u8f7d\u539f\u7406<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u5728 Springboot \u542f\u52a8\u6d41\u7a0b\u52a0\u8f7d\u914d\u7f6e\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(248, 35, 35);\">prepareEnvironment()<\/code> \u65b9\u6cd5\u4e2d\uff0c\u6709\u4e00\u4e2a\u91cd\u8981\u7684\u6b65\u9aa4\u65b9\u6cd5 <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(248, 35, 35);\">bindToSpringApplication(environment)<\/code>\uff0c\u5b83\u7684\u4f5c\u7528\u662f\u5c06\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u5c5e\u6027\u503c\u7ed1\u5b9a\u5230\u88ab <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(248, 35, 35);\">@ConfigurationProperties<\/code> \u6ce8\u89e3\u6807\u8bb0\u7684 Bean\u5bf9\u8c61\u4e2d\u3002\u4f46\u6b64\u65f6\u8fd9\u4e9b\u5bf9\u8c61\u8fd8\u6ca1\u6709\u88ab Spring \u5bb9\u5668\u7ba1\u7406\uff0c\u56e0\u6b64\u65e0\u6cd5\u5b8c\u6210\u5c5e\u6027\u7684\u81ea\u52a8\u6ce8\u5165\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u90a3\u4e48\u8fd9\u4e9bBean\u5bf9\u8c61\u53c8\u662f\u4ec0\u4e48\u65f6\u5019\u88ab\u6ce8\u518c\u5230 Spring \u5bb9\u5668\u4e2d\u7684\u5462\uff1f<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u8fd9\u5c31\u6d89\u53ca\u5230\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(248, 35, 35);\">ConfigurationPropertiesBindingPostProcessor<\/code> \u7c7b\uff0c\u5b83\u662f Bean\u540e\u7f6e\u5904\u7406\u5668\uff0c\u8d1f\u8d23\u626b\u63cf\u5bb9\u5668\u4e2d\u6240\u6709\u88ab @ConfigurationProperties \u6ce8\u89e3\u6240\u6807\u8bb0\u7684 Bean\u5bf9\u8c61\u3002\u5982\u679c\u627e\u5230\u4e86\uff0c\u5219\u4f1a\u4f7f\u7528 Binder \u7ec4\u4ef6\u5c06\u5916\u90e8\u5c5e\u6027\u7684\u503c\u7ed1\u5b9a\u5230\u5b83\u4eec\u8eab\u4e0a\uff0c\u4ece\u800c\u5b9e\u73b0\u81ea\u52a8\u6ce8\u5165\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;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.4301675977653631\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-03\/202307141728036a6a9c19e.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-type=\"png\" data-w=\"1074\" style=\"display: block;margin-right: auto;margin-left: auto;height: auto !important;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.4301675977653631\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-03\/202307141728036a6a9c19e.png\" data-type=\"png\" data-w=\"1074\" style=\"display: block;margin-right: auto;margin-left: auto;height: auto !important;\"><\/noscript><br \/>\n <\/figure>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <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(248, 35, 35);\">bindToSpringApplication<\/code> \u4e3b\u8981\u662f\u5c06\u5c5e\u6027\u503c\u7ed1\u5b9a\u5230 Bean \u5bf9\u8c61\u4e2d\uff1b<br \/>\n   <\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <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(248, 35, 35);\">ConfigurationPropertiesBindingPostProcessor<\/code> \u8d1f\u8d23\u5728 Spring \u5bb9\u5668\u542f\u52a8\u65f6\u5c06\u88ab\u6ce8\u89e3\u6807\u8bb0\u7684 Bean \u5bf9\u8c61\u6ce8\u518c\u5230\u5bb9\u5668\u4e2d\uff0c\u5e76\u5b8c\u6210\u540e\u7eed\u7684\u5c5e\u6027\u6ce8\u5165\u64cd\u4f5c\uff1b<br \/>\n   <\/section>\n<\/li>\n<\/ul>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;font-size: 20px;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span>\u5982\u4f55\u4f7f\u7528<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u6f14\u793a\u4f7f\u7528 @ConfigurationProperties \u6ce8\u89e3\uff0c\u5728 application.yml \u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0\u914d\u7f6e\u9879\uff1a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.6305185011981105&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #d19a66;line-height: 26px;\">env101:<\/span><br>&nbsp;&nbsp;<span style=\"color: #d19a66;line-height: 26px;\">var1:<\/span>&nbsp;<span style=\"color: #98c379;line-height: 26px;\">var1-\u516c\u4f17\u53f7\uff1a\u7a0b\u5e8f\u5458\u5c0f\u5bcc<\/span><br>&nbsp;&nbsp;<span style=\"color: #d19a66;line-height: 26px;\">var2:<\/span>&nbsp;<span style=\"color: #98c379;line-height: 26px;\">var2-\u516c\u4f17\u53f7\uff1a\u7a0b\u5e8f\u5458\u5c0f\u5bcc<\/span><br><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u521b\u5efa\u4e00\u4e2a MyConf \u7c7b\u7528\u4e8e\u627f\u8f7d\u6240\u6709\u524d\u7f00\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(248, 35, 35);\">env101<\/code>\u7684\u914d\u7f6e\u5c5e\u6027\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.763359189192975&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@Data<\/span><br><span style=\"color: #61aeee;line-height: 26px;\">@Configuration<\/span><br><span style=\"color: #61aeee;line-height: 26px;\">@ConfigurationProperties<\/span>(prefix&nbsp;=&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"env101\"<\/span>)<br><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">MyConf<\/span>&nbsp;<\/span>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;String&nbsp;var1;<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;String&nbsp;var2;<br>}<br><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u5728\u9700\u8981\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(248, 35, 35);\">var1<\/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(248, 35, 35);\">var2<\/code>\u5c5e\u6027\u503c\u7684\u5730\u65b9\uff0c\u5c06 MyConf \u5bf9\u8c61\u6ce8\u5165\u5230\u4f9d\u8d56\u5bf9\u8c61\u4e2d\u5373\u53ef\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.21929661656355792&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@Slf<\/span>4j<br><span style=\"color: #61aeee;line-height: 26px;\">@SpringBootTest<\/span><br><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">ConfTest<\/span>&nbsp;<\/span>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Resource<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;MyConf&nbsp;myConf;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Test<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">myConfTest<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<\/span>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log.info(<span style=\"color: #98c379;line-height: 26px;\">\"@ConfigurationProperties\u6ce8\u89e3&nbsp;\u914d\u7f6e\u83b7\u53d6&nbsp;{}\"<\/span>,&nbsp;JSON.toJSONString(myConf));<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><\/code><\/pre>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;border-bottom: 2px solid rgb(9, 142, 252);font-size: 1.3em;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span><span style=\"display: inline-block;background: rgb(9, 142, 252);color: rgb(255, 255, 255);padding: 3px 10px 1px;border-top-right-radius: 3px;border-top-left-radius: 3px;margin-right: 3px;\">\u56db\u3001@PropertySources \u6ce8\u89e3<\/span><span style=\"display: inline-block;vertical-align: bottom;border-bottom: 36px solid #efebe9;border-right: 20px solid transparent;\"> <\/span><\/h2>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u9664\u4e86\u7cfb\u7edf\u9ed8\u8ba4\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(248, 35, 35);\">application.yml<\/code> \u6216\u8005 <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(248, 35, 35);\">application.properties<\/code> \u6587\u4ef6\u5916\uff0c\u6211\u4eec\u8fd8\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u81ea\u5b9a\u4e49\u7684\u914d\u7f6e\u6587\u4ef6\u6765\u5b9e\u73b0\u66f4\u52a0\u7075\u6d3b\u548c\u4e2a\u6027\u5316\u7684\u914d\u7f6e\u3002\u4e0e\u9ed8\u8ba4\u7684\u914d\u7f6e\u6587\u4ef6\u4e0d\u540c\u7684\u662f\uff0c\u81ea\u5b9a\u4e49\u7684\u914d\u7f6e\u6587\u4ef6\u65e0\u6cd5\u88ab\u5e94\u7528\u81ea\u52a8\u52a0\u8f7d\uff0c\u9700\u8981\u6211\u4eec\u624b\u52a8\u6307\u5b9a\u52a0\u8f7d\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\"><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(248, 35, 35);\">@PropertySources<\/code> \u6ce8\u89e3\u7684\u5b9e\u73b0\u539f\u7406\u76f8\u5bf9\u7b80\u5355\uff0c\u5e94\u7528\u7a0b\u5e8f\u542f\u52a8\u65f6\u626b\u63cf\u6240\u6709\u88ab\u8be5\u6ce8\u89e3\u6807\u6ce8\u7684\u7c7b\uff0c\u83b7\u53d6\u5230\u6ce8\u89e3\u4e2d\u6307\u5b9a\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u7684\u8def\u5f84\uff0c\u5c06\u6307\u5b9a\u8def\u5f84\u4e0b\u7684\u914d\u7f6e\u6587\u4ef6\u5185\u5bb9\u52a0\u8f7d\u5230 Environment \u4e2d\uff0c\u8fd9\u6837\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(248, 35, 35);\">@Value<\/code> \u6ce8\u89e3\u6216 <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(248, 35, 35);\">Environment.getProperty()<\/code> \u65b9\u6cd5\u6765\u83b7\u53d6\u5176\u4e2d\u5b9a\u4e49\u7684\u5c5e\u6027\u503c\u4e86\u3002<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;font-size: 20px;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span>\u5982\u4f55\u4f7f\u7528<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u5728 src\/main\/resources\/ \u76ee\u5f55\u4e0b\u521b\u5efa\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6 <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(248, 35, 35);\">xiaofu.properties<\/code>\uff0c\u589e\u52a0\u4e24\u4e2a\u5c5e\u6027\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.6929656612594466&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #98c379;line-height: 26px;\">env101.var9=var9-\u7a0b\u5e8f\u5458\u5c0f\u5bcc<\/span><br><span style=\"color: #98c379;line-height: 26px;\">env101.var10=var10-\u7a0b\u5e8f\u5458\u5c0f\u5bcc<\/span><br><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u5728\u9700\u8981\u4f7f\u7528\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u7684\u7c7b\u4e0a\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(248, 35, 35);\">@PropertySources<\/code> \u6ce8\u89e3\uff0c\u6ce8\u89e3 value\u5c5e\u6027\u4e2d\u6307\u5b9a\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u7684\u8def\u5f84\uff0c\u53ef\u4ee5\u6307\u5b9a\u591a\u4e2a\u8def\u5f84\uff0c\u7528\u9017\u53f7\u9694\u5f00\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.6605776699111268&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@Data<\/span><br><span style=\"color: #61aeee;line-height: 26px;\">@Configuration<\/span><br><span style=\"color: #61aeee;line-height: 26px;\">@PropertySources<\/span>({<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@PropertySource<\/span>(value&nbsp;=&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"classpath:xiaofu.properties\"<\/span>,encoding&nbsp;=&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"utf-8\"<\/span>),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@PropertySource<\/span>(value&nbsp;=&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"classpath:xiaofu.properties\"<\/span>,encoding&nbsp;=&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"utf-8\"<\/span>)<br>})<br><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">PropertySourcesConf<\/span>&nbsp;<\/span>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Value<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"${env101.var10}\"<\/span>)<br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;String&nbsp;var10;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Value<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"${env101.var9}\"<\/span>)<br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;String&nbsp;var9;<br>}<br><br><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u6210\u529f\u83b7\u53d6\u914d\u7f6e\u4e86<\/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;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.0962962962962963\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-03\/202307141728030a0a4118a.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-type=\"png\" data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;height: auto !important;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.0962962962962963\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-03\/202307141728030a0a4118a.png\" data-type=\"png\" data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;height: auto !important;\"><\/noscript><br \/>\n <\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u4f46\u662f\u5f53\u6211\u8bd5\u56fe\u52a0\u8f7d<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(248, 35, 35);\">.yaml<\/code>\u6587\u4ef6\u65f6\uff0c\u542f\u52a8\u9879\u76ee\u5c45\u7136\u62a5\u9519\u4e86\uff0c\u7ecf\u8fc7\u4e00\u756a\u6478\u7d22\u6211\u53d1\u73b0\uff0c@PropertySources \u6ce8\u89e3\u53ea\u5185\u7f6e\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(248, 35, 35);\">PropertySourceFactory<\/code>\u9002\u914d\u5668\u3002\u4e5f\u5c31\u662f\u8bf4\u5b83\u53ea\u80fd\u52a0\u8f7d<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(248, 35, 35);\">.properties<\/code>\u6587\u4ef6\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;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.44166666666666665\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-03\/202307141728032929f70bd.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-type=\"png\" data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;height: auto !important;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.44166666666666665\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-03\/202307141728032929f70bd.png\" data-type=\"png\" data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;height: auto !important;\"><\/noscript><br \/>\n <\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u90a3\u5982\u679c\u6211\u60f3\u8981\u52a0\u8f7d\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(248, 35, 35);\">.yaml<\/code>\u7c7b\u578b\u6587\u4ef6\uff0c\u5219\u9700\u8981\u81ea\u884c\u5b9e\u73b0yaml\u7684\u9002\u914d\u5668 <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(248, 35, 35);\">YamlPropertySourceFactory<\/code>\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.18447212653588996&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">YamlPropertySourceFactory<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">implements<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">PropertySourceFactory<\/span>&nbsp;<\/span>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Override<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;PropertySource&lt;?&gt;&nbsp;createPropertySource(String&nbsp;name,&nbsp;EncodedResource&nbsp;encodedResource)&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">throws<\/span>&nbsp;IOException&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;YamlPropertiesFactoryBean&nbsp;factory&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;YamlPropertiesFactoryBean();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;factory.setResources(encodedResource.getResource());<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Properties&nbsp;properties&nbsp;=&nbsp;factory.getObject();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;PropertiesPropertySource(encodedResource.getResource().getFilename(),&nbsp;properties);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u800c\u5728\u52a0\u8f7d\u914d\u7f6e\u65f6\u8981\u663e\u793a\u7684\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(248, 35, 35);\">YamlPropertySourceFactory<\/code>\u9002\u914d\u5668\uff0c\u8fd9\u6837\u5c31\u5b8c\u6210\u4e86@PropertySource\u6ce8\u89e3\u52a0\u8f7d yaml \u6587\u4ef6\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.4581201144901492&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@Data<\/span><br><span style=\"color: #61aeee;line-height: 26px;\">@Configuration<\/span><br><span style=\"color: #61aeee;line-height: 26px;\">@PropertySources<\/span>({<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@PropertySource<\/span>(value&nbsp;=&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"classpath:xiaofu.yaml\"<\/span>,&nbsp;encoding&nbsp;=&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"utf-8\"<\/span>,&nbsp;factory&nbsp;=&nbsp;YamlPropertySourceFactory<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)<br>})<br><span style=\"color: #e6c07b;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">PropertySourcesConf2<\/span>&nbsp;<\/span>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Value<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"${env101.var10}\"<\/span>)<br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;String&nbsp;var10;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Value<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"${env101.var9}\"<\/span>)<br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;String&nbsp;var9;<br>}<br><\/code><\/pre>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;border-bottom: 2px solid rgb(9, 142, 252);font-size: 1.3em;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span><span style=\"display: inline-block;background: rgb(9, 142, 252);color: rgb(255, 255, 255);padding: 3px 10px 1px;border-top-right-radius: 3px;border-top-left-radius: 3px;margin-right: 3px;\">\u4e94\u3001YamlPropertiesFactoryBean \u52a0\u8f7d YAML \u6587\u4ef6<\/span><span style=\"display: inline-block;vertical-align: bottom;border-bottom: 36px solid #efebe9;border-right: 20px solid transparent;\"> <\/span><\/h2>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u6211\u4eec\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(248, 35, 35);\">YamlPropertiesFactoryBean<\/code> \u7c7b\u5c06 YAML \u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u5c5e\u6027\u503c\u6ce8\u5165\u5230 Bean \u4e2d\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.7412561065213215&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@Configuration<\/span><br><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">MyYamlConfig<\/span>&nbsp;<\/span>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Bean<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">static<\/span>&nbsp;PropertySourcesPlaceholderConfigurer&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">yamlConfigurer<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<\/span>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PropertySourcesPlaceholderConfigurer&nbsp;configurer&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;PropertySourcesPlaceholderConfigurer();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;YamlPropertiesFactoryBean&nbsp;yaml&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;YamlPropertiesFactoryBean();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;yaml.setResources(<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;ClassPathResource(<span style=\"color: #98c379;line-height: 26px;\">\"xiaofu.yml\"<\/span>));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;configurer.setProperties(Objects.requireNonNull(yaml.getObject()));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;configurer;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\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(248, 35, 35);\">@Value<\/code> \u6ce8\u89e3\u6216 <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(248, 35, 35);\">Environment.getProperty()<\/code> \u65b9\u6cd5\u6765\u83b7\u53d6\u5176\u4e2d\u5b9a\u4e49\u7684\u5c5e\u6027\u503c\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.9136098778828623&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\">@Slf4j<br>@SpringBootTest<br>public&nbsp;class&nbsp;YamlTest&nbsp;{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;@Value(<span style=\"color: #98c379;line-height: 26px;\">\"<span style=\"color: #d19a66;line-height: 26px;\">${env101.var11}<\/span>\"<\/span>)<br>&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;String&nbsp;var11;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;@Test<br>&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;void&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #61aeee;line-height: 26px;\">myYamlTest<\/span><\/span>()&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log.info(<span style=\"color: #98c379;line-height: 26px;\">\"Yaml&nbsp;\u914d\u7f6e\u83b7\u53d6&nbsp;{}\"<\/span>,&nbsp;var11);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><\/code><\/pre>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;border-bottom: 2px solid rgb(9, 142, 252);font-size: 1.3em;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span><span style=\"display: inline-block;background: rgb(9, 142, 252);color: rgb(255, 255, 255);padding: 3px 10px 1px;border-top-right-radius: 3px;border-top-left-radius: 3px;margin-right: 3px;\">\u516d\u3001\u81ea\u5b9a\u4e49\u8bfb\u53d6<\/span><span style=\"display: inline-block;vertical-align: bottom;border-bottom: 36px solid #efebe9;border-right: 20px solid transparent;\"> <\/span><\/h2>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u5982\u679c\u4e0a\u8fb9\u7684\u51e0\u79cd\u8bfb\u53d6\u914d\u7f6e\u7684\u65b9\u5f0f\u4f60\u90fd\u4e0d\u559c\u6b22\uff0c\u5c31\u60f3\u81ea\u5df1\u5199\u4e2a\u66f4\u6d41\u6279\u7684\u8f6e\u5b50\uff0c\u90a3\u4e5f\u5f88\u597d\u529e\u3002\u6211\u4eec\u76f4\u63a5\u6ce8\u5165<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(248, 35, 35);\">PropertySources<\/code>\u83b7\u53d6\u6240\u6709\u5c5e\u6027\u7684\u914d\u7f6e\u961f\u5217\uff0c\u4f60\u662f\u60f3\u7528\u6ce8\u89e3\u5b9e\u73b0\u8fd8\u662f\u5176\u4ed6\u4ec0\u4e48\u65b9\u5f0f\uff0c\u5c31\u53ef\u4ee5\u4e3a\u6240\u6b32\u4e3a\u4e86\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/CJ35Z2cnZA2hicZfqbzstReXLhq5ibbNtZwB2HgSg6M29MUq6QeHQq43vNNS6WFban9feT9AlrngRkLvHQC3IoBoYwtw60klnn\/640?wx_fmt=svg&amp;random=0.8091071373804408&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@Slf<\/span>4j<br><span style=\"color: #61aeee;line-height: 26px;\">@SpringBootTest<\/span><br><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">CustomTest<\/span>&nbsp;<\/span>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Autowired<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;PropertySources&nbsp;propertySources;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Test<\/span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">customTest<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<\/span>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">for<\/span>&nbsp;(PropertySource&lt;?&gt;&nbsp;propertySource&nbsp;:&nbsp;propertySources)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log.info(<span style=\"color: #98c379;line-height: 26px;\">\"\u81ea\u5b9a\u4e49\u83b7\u53d6&nbsp;\u914d\u7f6e\u83b7\u53d6&nbsp;name&nbsp;{}&nbsp;,{}\"<\/span>,&nbsp;propertySource.getName(),&nbsp;propertySource.getSource());<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><\/code><\/pre>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;font-weight: bold;border-bottom: 2px solid rgb(9, 142, 252);font-size: 1.3em;color: rgb(9, 142, 252) !important;\"><span style=\"display: none;\"><\/span><span style=\"display: inline-block;background: rgb(9, 142, 252);color: rgb(255, 255, 255);padding: 3px 10px 1px;border-top-right-radius: 3px;border-top-left-radius: 3px;margin-right: 3px;\">\u603b\u7ed3<\/span><span style=\"display: inline-block;vertical-align: bottom;border-bottom: 36px solid #efebe9;border-right: 20px solid transparent;\"> <\/span><\/h2>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u6211\u4eec\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(248, 35, 35);\">@Value<\/code> \u6ce8\u89e3\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(248, 35, 35);\">Environment<\/code> \u7c7b\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(248, 35, 35);\">@ConfigurationProperties<\/code> \u6ce8\u89e3\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(248, 35, 35);\">@PropertySource<\/code> \u6ce8\u89e3\u7b49\u65b9\u5f0f\u6765\u83b7\u53d6\u914d\u7f6e\u4fe1\u606f\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u5176\u4e2d\uff0c@Value \u6ce8\u89e3\u9002\u7528\u4e8e\u5355\u4e2a\u503c\u7684\u6ce8\u5165\uff0c\u800c\u5176\u4ed6\u51e0\u79cd\u65b9\u5f0f\u9002\u7528\u4e8e\u6279\u91cf\u914d\u7f6e\u7684\u6ce8\u5165\u3002\u4e0d\u540c\u7684\u65b9\u5f0f\u5728\u6548\u7387\u3001\u7075\u6d3b\u6027\u3001\u6613\u7528\u6027\u7b49\u65b9\u9762\u5b58\u5728\u5dee\u5f02\uff0c\u5728\u9009\u62e9\u914d\u7f6e\u83b7\u53d6\u65b9\u5f0f\u65f6\uff0c\u8fd8\u9700\u8981\u8003\u8651\u4e2a\u4eba\u7f16\u7a0b\u4e60\u60ef\u548c\u4e1a\u52a1\u9700\u6c42\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;word-spacing: 1.8px;letter-spacing: 1.2px;\">\u5982\u679c\u91cd\u89c6\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\uff0c\u5219\u53ef\u4ee5\u9009\u62e9\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(248, 35, 35);\">@ConfigurationProperties<\/code> \u6ce8\u89e3\uff1b\u5982\u679c\u66f4\u6ce8\u91cd\u8fd0\u884c\u6548\u7387\uff0c\u5219\u53ef\u4ee5\u9009\u62e9\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(248, 35, 35);\">Environment<\/code> \u7c7b\u3002\u603b\u4e4b\uff0c\u4e0d\u540c\u7684\u573a\u666f\u9700\u8981\u9009\u62e9\u4e0d\u540c\u7684\u65b9\u5f0f\uff0c\u4ee5\u8fbe\u5230\u6700\u4f18\u7684\u6548\u679c\u3002<\/p>\n<pre style=\"outline: 0px;letter-spacing: 0.544px;text-align: center;widows: 1;color: rgb(34, 34, 34);background-color: rgb(255, 255, 255);\"><pre style=\"outline: 0px;font-size: 16px;letter-spacing: 0.544px;text-align: left;color: rgb(0, 0, 0);background-color: rgb(255, 255, 255);font-weight: 700;orphans: 4;widows: 1;word-spacing: 1px;caret-color: rgb(255, 0, 0);visibility: visible;\"><pre style=\"outline: 0px;letter-spacing: 0.544px;color: rgb(62, 62, 62);caret-color: rgb(60, 60, 60);visibility: visible;\">\n    <section data-tool=\"mdnice\u7f16\u8f91\u5668\" data-website=\"https:\/\/www.mdnice.com\" style=\"padding-right: 10px;padding-left: 10px;outline: 0px;caret-color: rgb(255, 0, 0);white-space: normal;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;letter-spacing: 0px;text-size-adjust: inherit;line-height: 1.6;word-break: break-word;visibility: visible;\">\n     <h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 20px;margin-bottom: 15px;outline: 0px;font-weight: bold;font-size: 1.3em;caret-color: rgb(0, 0, 0);border-bottom: 2px solid rgb(239, 112, 96);text-align: center;visibility: visible;\"><span style=\"margin-right: 3px;padding: 3px 10px 1px;outline: 0px;display: inline-block;background-color: rgb(239, 112, 96);color: rgb(255, 255, 255);border-top-right-radius: 3px;border-top-left-radius: 3px;letter-spacing: 1px;font-size: 20px;visibility: visible;\">\u7a0b\u5e8f\u6c6a\u8d44\u6599\u94fe\u63a5<\/span><\/h2>\n    <\/section>\n    <section data-recommend-title=\"t\" data-recommend-content=\"t\" data-mid=\"\" style=\"outline: 0px;color: rgb(63, 63, 63);letter-spacing: 0.544px;caret-color: rgb(255, 0, 0);white-space: normal;font-family: -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;text-size-adjust: inherit;line-height: 1.75em;visibility: visible;\">\n     <p style=\"outline: 0px;line-height: 1.75em;visibility: visible;\"><a target=\"_blank\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA4NzQ0Njc4Ng==&amp;mid=2247501524&amp;idx=1&amp;sn=2cb28e7b64ab77c55bcc1a172b82a2ad&amp;chksm=903bc2b9a74c4baf5737cd430560ee3c5a357bb37864257a05a72e3cccf41db5bd221ccc63d8&amp;scene=21#wechat_redirect\" data-itemshowtype=\"0\" tab=\"innerlink\" data-linktype=\"2\" hasload=\"1\" wah-hotarea=\"click\" style=\"outline: 0px;color: rgb(0, 128, 255);text-decoration: underline;cursor: pointer;visibility: visible;\" rel=\"noopener\" rel=\"nofollow\" >\u7a0b\u5e8f\u6c6a\u63a5\u76847\u4e2a\u79c1\u6d3b\u90fd\u5728\u8fd9\u91cc\uff0c\u7ecf\u9a8c\u6574\u7406<\/a><\/p>\n     <p style=\"outline: 0px;line-height: 1.75em;letter-spacing: 0.544px;text-size-adjust: inherit;word-break: break-word;visibility: visible;\"><a target=\"_blank\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=Mzg2ODU0NTA2Mw==&amp;mid=2247488419&amp;idx=2&amp;sn=0b80c7f9f73fca89b91e257a269cfada&amp;chksm=ceabf4ebf9dc7dfdaa605a9bb92d31c9fc0a10a7a94351234181a89ba5800672c6e7da2ebfbe&amp;scene=21#wechat_redirect\" textvalue=\"Java\u9879\u76ee\u5206\u4eab  \u6700\u65b0\u6574\u7406\u5168\u96c6\uff0c\u627e\u9879\u76ee\u4e0d\u7d2f\u5566 07\u7248\" linktype=\"text\" imgurl=\"\" imgdata=\"null\" data-itemshowtype=\"0\" tab=\"innerlink\" data-linktype=\"2\" wah-hotarea=\"click\" hasload=\"1\" style=\"outline: 0px;color: rgb(0, 128, 255);text-decoration: underline;cursor: pointer;visibility: visible;\" rel=\"noopener\" rel=\"nofollow\" ><span style=\"outline: 0px;visibility: visible;\"><strong style=\"outline: 0px;visibility: visible;\">Java\u9879\u76ee\u5206\u4eab &nbsp;\u6700\u65b0\u6574\u7406\u5168\u96c6\uff0c\u627e\u9879\u76ee\u4e0d\u7d2f\u5566 07\u7248<\/strong><strong style=\"outline: 0px;visibility: visible;\"><\/strong><\/span><\/a><br style=\"outline: 0px;visibility: visible;\"><\/p>\n     <p style=\"outline: 0px;line-height: 1.75em;visibility: visible;\"><a target=\"_blank\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA4NzQ0Njc4Ng==&amp;mid=2247494170&amp;idx=1&amp;sn=5181a5277946be31478b1b9425c93f63&amp;chksm=903bee77a74c67614b2772248e8b5e912d323bfe42a0e576dd157a4752f5fed88d6b439ec52f&amp;scene=21#wechat_redirect\" data-itemshowtype=\"0\" tab=\"innerlink\" data-linktype=\"2\" hasload=\"1\" wah-hotarea=\"click\" style=\"outline: 0px;color: rgb(0, 128, 255);text-decoration: underline;cursor: pointer;letter-spacing: 0.544px;visibility: visible;\" rel=\"noopener\" rel=\"nofollow\" ><strong style=\"outline: 0px;visibility: visible;\">\u582a\u79f0\u795e\u7ea7\u7684Spring Boot\u624b\u518c\uff0c\u4ece\u57fa\u7840\u5165\u95e8\u5230\u5b9e\u6218\u8fdb\u9636<\/strong><\/a><\/p>\n     <p style=\"outline: 0px;visibility: visible;\"><a target=\"_blank\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA4NzQ0Njc4Ng==&amp;mid=2247492941&amp;idx=1&amp;sn=2ff31fec735d7c5d6f3483c346d5ca69&amp;chksm=903be120a74c68361fd9afad178e7338315041a2cd4459f2165a8faa20e995a3477af3eda2bb&amp;scene=21#wechat_redirect\" data-itemshowtype=\"0\" tab=\"innerlink\" data-linktype=\"2\" hasload=\"1\" wah-hotarea=\"click\" style=\"outline: 0px;color: rgb(0, 128, 255);text-decoration: underline;cursor: pointer;visibility: visible;\" rel=\"noopener\" rel=\"nofollow\" ><strong style=\"outline: 0px;visibility: visible;\">\u5367\u69fd\uff01\u5b57\u8282\u8df3\u52a8\u300a\u7b97\u6cd5\u4e2d\u6587\u624b\u518c\u300b\u706b\u4e86\uff0c\u5b8c\u6574\u7248 PDF \u5f00\u653e\u4e0b\u8f7d\uff01<\/strong><\/a><\/p>\n     <p style=\"outline: 0px;visibility: visible;\"><a target=\"_blank\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA4NzQ0Njc4Ng==&amp;mid=2247496297&amp;idx=2&amp;sn=d253dda2160821262d9f6fc1a9a637d0&amp;chksm=903bf604a74c7f126ab936e374a1f22b9b7cb26a7964b6cc837c3f73af516139064e522a1294&amp;scene=21#wechat_redirect\" data-itemshowtype=\"0\" tab=\"innerlink\" data-linktype=\"2\" hasload=\"1\" wah-hotarea=\"click\" style=\"outline: 0px;color: rgb(0, 128, 255);text-decoration: underline;cursor: pointer;visibility: visible;\" rel=\"noopener\" rel=\"nofollow\" ><strong style=\"outline: 0px;visibility: visible;\">\u5367\u69fd\uff01\u963f\u91cc\u5927\u4f6c\u603b\u7ed3\u7684\u300a\u56fe\u89e3Java\u300b\u706b\u4e86\uff0c\u5b8c\u6574\u7248PDF\u5f00\u653e\u4e0b\u8f7d\uff01<\/strong><\/a><\/p>\n     <p style=\"outline: 0px;visibility: visible;\"><a target=\"_blank\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA4NzQ0Njc4Ng==&amp;mid=2247490715&amp;idx=2&amp;sn=7f2c5de11bebaecfbaf1ce4b945a4d6f&amp;chksm=903818f6a74f91e0fde557b75bd44adfd5d378612f682aa3eef6766927aebb9e5afc72c91a9e&amp;scene=21#wechat_redirect\" data-itemshowtype=\"0\" tab=\"innerlink\" data-linktype=\"2\" hasload=\"1\" wah-hotarea=\"click\" style=\"outline: 0px;color: rgb(0, 128, 255);text-decoration: underline;cursor: pointer;visibility: visible;\" rel=\"noopener\" rel=\"nofollow\" ><strong style=\"outline: 0px;visibility: visible;\">\u5b57\u8282\u8df3\u52a8\u603b\u7ed3\u7684\u8bbe\u8ba1\u6a21\u5f0f PDF \u706b\u4e86\uff0c\u5b8c\u6574\u7248\u5f00\u653e\u4e0b\u8f7d\uff01<\/strong><\/a><\/p>\n     <section class=\"mp_profile_iframe_wrp\" style=\"outline: 0px;visibility: visible;\">\n      <mp-common-profile class=\"js_uneditable js_wx_tap_highlight\" data-pluginname=\"mpprofile\" data-id=\"MzA4NzQ0Njc4Ng==\" data-headimg=\"http:\/\/mmbiz.qpic.cn\/mmbiz_png\/obDoO79MTFFj7yxAU4nibk9t37xxUNx4PRy8QKpqibgry1mqiaYu5NLaoAibgHHkCtrKvgoEu6xz63UNQRAGBxF2Mg\/0?wx_fmt=png\" data-nickname=\"\u6211\u662f\u7a0b\u5e8f\u6c6a\" data-alias=\"woshichengxuwang\" data-signature=\"\u6df1\u8015IT\u54a8\u8be2\uff0c10\u5e74\u5f00\u53d1\u8001\u5175\u5e2e\u4f60\u5c11\u8d70\u5f2f\u8def\uff0c\u5206\u4eab\u6211\u7684\u5de5\u4f5c\u548c\u63a5\u79c1\u6d3b\u7ecf\u9a8c\uff0c\u66f4\u5173\u6ce8\u5e95\u5c42\u7801\u519c \u8f6c\u884c\u3001\u57f9\u8bad\u3001\u81ea\u5b66\u7684\u5c0f\u767d\u7a0b\u5e8f\u5458\" data-from=\"2\" data-is_biz_ban=\"0\" has-insert-preloading=\"1\" data-index=\"0\" data-origin_num=\"204\" data-isban=\"0\" data-weui-theme=\"light\" data-biz_account_status=\"0\"><\/mp-common-profile>\n     <\/section>\n    <\/section><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin: 10px;padding-top: 8px;padding-bottom: 8px;outline: 0px;font-weight: 400;orphans: 2;white-space: normal;widows: 2;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.75;letter-spacing: 0.2em;font-size: 15px;word-spacing: 0.1em;visibility: visible;\"><span style=\"outline: 0px;color: rgb(122, 79, 214);font-variant-ligatures: common-ligatures;font-weight: 700;letter-spacing: 0.544px;orphans: 4;widows: 1;word-spacing: 1px;visibility: visible;\">\u6b22\u8fce\u6dfb\u52a0\u7a0b\u5e8f\u6c6a\u4e2a\u4eba\u5fae\u4fe1 itwang007&nbsp; \u8fdb\u7c89\u4e1d\u7fa4\u6216\u56f4\u89c2\u670b\u53cb\u5708<\/span><\/p>\n<p style=\"margin-bottom: 0em;outline: 0px;white-space: normal;caret-color: rgb(60, 60, 60);font-family: system-ui, -apple-system, system-ui, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 0.544px;\"><\/p>\n<\/section>\n<p style=\"display: none;\">\n <mp-style-type data-value=\"3\"><\/mp-style-type><\/p>\n<p>\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e\u5fae\u4fe1\u516c\u4f17\u53f7\uff1ahttps:\/\/mp.weixin.qq.com\/s\/jqPoCMfrEMhZWw3DpLEvtA<\/p>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>\u4ece\u914d\u7f6e\u6587\u4ef6\u4e2d\u83b7\u53d6\u5c5e\u6027\u5e94\u8be5\u662fSpringBoot\u5f00\u53d1\u4e2d\u6700\u4e3a\u5e38\u7528\u7684\u529f\u80fd\u4e4b\u4e00\uff0c\u4f46\u5c31\u662f\u8fd9\u4e48\u5e38\u7528\u7684\u529f\u80fd\uff0c\u4ecd\u7136\u6709\u5f88\u591a\u5f00\u53d1\u8005\u5728\u8fd9\u4e2a\u65b9\u9762\u8e29\u5751\u3002 \u6211 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"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-2971","post","type-post","status-publish","format-standard","hentry","category-spring-boot"],"post_thumbnail_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-01\/20230714172801b0b057ab4.png","content_first_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-01\/20230714172801b0b057ab4.png","post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-01\/20230714172801b0b057ab4.png","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-01\/20230714172801b0b057ab4.png","post_frist_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-01\/20230714172801b0b057ab4.png","post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-01\/20230714172801b0b057ab4.png","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-01\/20230714172801b0b057ab4.png","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-01\/20230714172801b0b057ab4.png","post_all_images":[{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-01\/20230714172801b0b057ab4.png","id":"image0"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-01\/20230714172801b0b057ab4.png","id":"image1"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-02\/20230714172802eaead6f3f.png","id":"image2"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-02\/20230714172802eaead6f3f.png","id":"image3"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-02\/202307141728027f7f2a433.png","id":"image4"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-02\/202307141728027f7f2a433.png","id":"image5"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-02\/20230714172802373749178.png","id":"image6"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-02\/20230714172802373749178.png","id":"image7"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-03\/202307141728036a6a9c19e.png","id":"image8"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-03\/202307141728036a6a9c19e.png","id":"image9"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-03\/202307141728030a0a4118a.png","id":"image10"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-03\/202307141728030a0a4118a.png","id":"image11"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-03\/202307141728032929f70bd.png","id":"image12"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/17-28-03\/202307141728032929f70bd.png","id":"image13"}],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"Spring Boot","post_date":"2023-07-14","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":250,"next_post_id":2983,"next_post_title":"\u901a\u8fc7\u5de5\u5382\u6a21\u5f0f\u5b9e\u73b0SpringBoot+MQTT-\u8ba2\u9605\u4e0e\u6d88\u8d39","previous_post_id":2967,"previous_post_title":"springBoot\u5bf9\u63a5kafka,\u6279\u91cf\u3001\u5e76\u53d1\u3001\u5f02\u6b65\u83b7\u53d6\u6d88\u606f,\u5e76\u52a8\u6001\u3001\u6279\u91cf\u63d2\u5165\u5e93\u8868","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/2971","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=2971"}],"version-history":[{"count":0,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/2971\/revisions"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}