{"id":1079,"date":"2023-05-28T02:28:29","date_gmt":"2023-05-27T18:28:29","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=1079"},"modified":"2023-05-28T02:28:29","modified_gmt":"2023-05-27T18:28:29","slug":"%e9%9d%a2%e8%af%95%e5%ae%98%ef%bc%9aspring-boot-%e5%81%9c%e6%ad%a2%e6%9c%8d%e5%8a%a1%e7%9a%84%e6%96%b9%e6%b3%95%e6%9c%89%e5%93%aa%e4%ba%9b%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/spring-boot\/%e9%9d%a2%e8%af%95%e5%ae%98%ef%bc%9aspring-boot-%e5%81%9c%e6%ad%a2%e6%9c%8d%e5%8a%a1%e7%9a%84%e6%96%b9%e6%b3%95%e6%9c%89%e5%93%aa%e4%ba%9b%ef%bc%9f\/","title":{"rendered":"\u9762\u8bd5\u5b98\uff1aSpring Boot \u505c\u6b62\u670d\u52a1\u7684\u65b9\u6cd5\u6709\u54ea\u4e9b\uff1f"},"content":{"rendered":"<div class='wxsyncmain'>\n<p style=\"text-align: left;\"><span style=\"color: rgb(136, 136, 136);font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;font-size: 14px;letter-spacing: 0.544px;background-color: rgb(255, 255, 255);\">\u539f\u6587\uff1a<\/span><br style=\"outline: 0px;max-width: 100%;color: rgb(136, 136, 136);font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;font-size: 14px;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;\"  \/><span style=\"color: rgb(136, 136, 136);font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;font-size: 14px;letter-spacing: 0.544px;background-color: rgb(255, 255, 255);\">cnblogs.com\/huangqingshi\/p\/11370291.html<\/span><\/p>\n<section><mp-common-profile class=\"js_uneditable custom_select_card mp_profile_iframe\" data-pluginname=\"mpprofile\" data-weui-theme=\"light\" data-id=\"MjM5NDQ4MzA1Nw==\" data-headimg=\"http:\/\/mmbiz.qpic.cn\/mmbiz_png\/7OPxOA8ic5m8iaZhZuawOQpg1kY6p7DsNdHYUDLY6XBfZYualr95vI5BKic0SbnZ7lzkibwdTfLmFkx9flmoEvLQiaQ\/0?wx_fmt=png\" data-nickname=\"IT\u725b\u5ba2\" data-alias=\"\" data-signature=\"\u4e13\u6ce8\u4e8eIT\u6280\u672f\u5206\u4eab\uff0c\u539f\u521b\u6280\u672f\u548c\u521b\u65b0\u6280\u672f\u5206\u4eab\uff0cIT\u725b\u5ba2\uff0c\u6211\u4eec\u4e00\u8d77\u8fdb\u6b65\u2026\u2026\" data-from=\"0\" data-is_biz_ban=\"0\"><\/mp-common-profile><\/section>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><span style=\"outline: 0px;max-width: 100%;font-size: 16px;box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u5728\u4f7f\u7528Springboot\u7684\u65f6\u5019\uff0c\u90fd\u8981\u6d89\u53ca\u5230\u670d\u52a1\u7684\u505c\u6b62\u548c\u542f\u52a8\uff0c\u5f53\u6211\u4eec\u505c\u6b62\u670d\u52a1\u7684\u65f6\u5019\uff0c\u5f88\u591a\u65f6\u5019\u5927\u5bb6\u90fd\u662fkill -9 \u76f4\u63a5\u628a\u7a0b\u5e8f\u8fdb\u7a0b\u6740\u6389\uff0c\u8fd9\u6837\u7a0b\u5e8f\u4e0d\u4f1a\u6267\u884c\u4f18\u96c5\u7684\u5173\u95ed\u3002\u800c\u4e14\u4e00\u4e9b\u6ca1\u6709\u6267\u884c\u5b8c\u7684\u7a0b\u5e8f\u5c31\u4f1a\u76f4\u63a5\u9000\u51fa\u3002<\/span><\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><br style=\"outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;\"  \/><\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><span style=\"outline: 0px;max-width: 100%;font-size: 16px;box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u6211\u4eec\u5f88\u591a\u65f6\u5019\u90fd\u9700\u8981\u5b89\u5168\u7684\u5c06\u670d\u52a1\u505c\u6b62\uff0c\u4e5f\u5c31\u662f\u628a\u6ca1\u6709\u5904\u7406\u5b8c\u7684\u5de5\u4f5c\u7ee7\u7eed\u5904\u7406\u5b8c\u6210\u3002\u6bd4\u5982\u505c\u6b62\u4e00\u4e9b\u4f9d\u8d56\u7684\u670d\u52a1\uff0c\u8f93\u51fa\u4e00\u4e9b\u65e5\u5fd7\uff0c\u53d1\u4e00\u4e9b\u4fe1\u53f7\u7ed9\u5176\u4ed6\u7684\u5e94\u7528\u7cfb\u7edf\uff0c\u8fd9\u4e2a\u5728\u4fdd\u8bc1\u7cfb\u7edf\u7684\u9ad8\u53ef\u7528\u662f\u975e\u5e38\u6709\u5fc5\u8981\u7684\u3002\u90a3\u4e48\u54b1\u4e48\u5c31\u6765\u770b\u4e00\u4e0b\u51e0\u79cd\u505c\u6b62springboot\u7684\u65b9\u6cd5\u3002<\/span><\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><span style=\"outline: 0px;max-width: 100%;font-size: 16px;box-sizing: border-box !important;overflow-wrap: break-word !important;\"><br style=\"outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;\"  \/><\/span><\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><span style=\"outline: 0px;max-width: 100%;font-size: 16px;box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u7b2c\u4e00\u79cd\u5c31\u662fSpringboot\u63d0\u4f9b\u7684actuator\u7684\u529f\u80fd\uff0c\u5b83\u53ef\u4ee5\u6267\u884cshutdown, health, info\u7b49\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cactuator\u7684shutdown\u662fdisable\u7684\uff0c\u6211\u4eec\u9700\u8981\u6253\u5f00\u5b83\u3002\u9996\u5148\u5f15\u5165acturator\u7684maven\u4f9d\u8d56\u3002<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"xml\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__tag\">&lt;<span class=\"code-snippet__name\">dependency<\/span>&gt;<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__tag\">&lt;<span class=\"code-snippet__name\">groupId<\/span>&gt;<\/span>org.springframework.boot<span class=\"code-snippet__tag\">&lt;\/<span class=\"code-snippet__name\">groupId<\/span>&gt;<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__tag\">&lt;<span class=\"code-snippet__name\">artifactId<\/span>&gt;<\/span>spring-boot-starter-actuator<span class=\"code-snippet__tag\">&lt;\/<span class=\"code-snippet__name\">artifactId<\/span>&gt;<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__tag\">&lt;\/<span class=\"code-snippet__name\">dependency<\/span>&gt;<\/span><\/span><\/code><\/pre>\n<\/section>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><span style=\"outline: 0px;max-width: 100%;font-size: 16px;box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u7136\u540e\u5c06shutdown\u8282\u70b9\u6253\u5f00\uff0c\u4e5f\u5c06\/actuator\/shutdown\u66b4\u9732web\u8bbf\u95ee\u4e5f\u8bbe\u7f6e\u4e0a\uff0c\u9664\u4e86shutdown\u4e4b\u5916\u8fd8\u6709health, info\u7684web\u8bbf\u95ee\u90fd\u6253\u5f00\u7684\u8bdd\u5c06management.endpoints.web.exposure.include=*\u5c31\u53ef\u4ee5\u3002\u5c06\u5982\u4e0b\u914d\u7f6e\u8bbe\u7f6e\u5230application.properties\u91cc\u8fb9\u3002\u8bbe\u7f6e\u4e00\u4e0b\u670d\u52a1\u7684\u7aef\u53e3\u53f7\u4e3a3333\u3002<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"php\"><code><span class=\"code-snippet_outer\">server.port=<span class=\"code-snippet__number\">3333<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">management.endpoint.shutdown.enabled=<span class=\"code-snippet__keyword\">true<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">management.endpoints.web.exposure.<span class=\"code-snippet__keyword\">include<\/span>=shutdown<\/span><\/code><\/pre>\n<\/section>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><span style=\"outline: 0px;max-width: 100%;font-size: 16px;box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u63a5\u4e0b\u6765\uff0c\u54b1\u4eec\u521b\u5efa\u4e00\u4e2aspringboot\u5de5\u7a0b\uff0c\u7136\u540e\u8bbe\u7f6e\u4e00\u4e2abean\u5bf9\u8c61\uff0c\u914d\u7f6e\u4e0aPreDestroy\u65b9\u6cd5\u3002\u8fd9\u6837\u5728\u505c\u6b62\u7684\u65f6\u5019\u4f1a\u6253\u5370\u8bed\u53e5\u3002bean\u7684\u6574\u4e2a\u751f\u547d\u5468\u671f\u5206\u4e3a\u521b\u5efa\u3001\u521d\u59cb\u5316\u3001\u9500\u6bc1\uff0c\u5f53\u6700\u540e\u5173\u95ed\u7684\u65f6\u5019\u4f1a\u6267\u884c\u9500\u6bc1\u64cd\u4f5c\u3002\u5728\u9500\u6bc1\u7684\u65b9\u6cd5\u4e2d\u6267\u884c\u4e00\u6761\u8f93\u51fa\u65e5\u5fd7\u3002<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"java\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">import<\/span> javax.annotation.PreDestroy;<\/span><\/code><code><span class=\"code-snippet_outer\"><br  \/><\/span><\/code><code><span class=\"code-snippet_outer\">publicclass TerminateBean {<\/span><\/code><code><span class=\"code-snippet_outer\"><br  \/><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__meta\">@PreDestroy<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">public<\/span> <span class=\"code-snippet__keyword\">void<\/span> <span class=\"code-snippet__title\">preDestroy<\/span><span class=\"code-snippet__params\">()<\/span> <\/span>{<\/span><\/code><code><span class=\"code-snippet_outer\">        System.out.println(<span class=\"code-snippet__string\">\"TerminalBean is destroyed\"<\/span>);<\/span><\/code><code><span class=\"code-snippet_outer\">    }<\/span><\/code><code><span class=\"code-snippet_outer\"><br  \/><\/span><\/code><code><span class=\"code-snippet_outer\">}<\/span><\/code><\/pre>\n<\/section>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><span style=\"outline: 0px;max-width: 100%;font-size: 16px;box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u505a\u4e00\u4e2aconfiguration\uff0c\u7136\u540e\u63d0\u4f9b\u4e00\u4e2a\u83b7\u53d6bean\u7684\u65b9\u6cd5\uff0c\u8fd9\u6837\u8be5bean\u5bf9\u8c61\u4f1a\u88ab\u521d\u59cb\u5316\u3002<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"css\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__selector-tag\">import<\/span> <span class=\"code-snippet__selector-tag\">com<\/span><span class=\"code-snippet__selector-class\">.hqs<\/span><span class=\"code-snippet__selector-class\">.springboot<\/span><span class=\"code-snippet__selector-class\">.shutdowndemo<\/span><span class=\"code-snippet__selector-class\">.bean<\/span><span class=\"code-snippet__selector-class\">.TerminateBean<\/span>;<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__selector-tag\">import<\/span> <span class=\"code-snippet__selector-tag\">org<\/span><span class=\"code-snippet__selector-class\">.springframework<\/span><span class=\"code-snippet__selector-class\">.context<\/span><span class=\"code-snippet__selector-class\">.annotation<\/span><span class=\"code-snippet__selector-class\">.Bean<\/span>;<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__selector-tag\">import<\/span> <span class=\"code-snippet__selector-tag\">org<\/span><span class=\"code-snippet__selector-class\">.springframework<\/span><span class=\"code-snippet__selector-class\">.context<\/span><span class=\"code-snippet__selector-class\">.annotation<\/span><span class=\"code-snippet__selector-class\">.Configuration<\/span>;<\/span><\/code><code><span class=\"code-snippet_outer\"><br  \/><\/span><\/code><code><span class=\"code-snippet_outer\">@<span class=\"code-snippet__keyword\">Configuration<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">publicclass ShutDownConfig {<\/span><\/code><code><span class=\"code-snippet_outer\"><br  \/><\/span><\/code><code><span class=\"code-snippet_outer\">    @<span class=\"code-snippet__keyword\">Bean<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    public TerminateBean getTerminateBean() {<\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__selector-tag\">returnnew<\/span> <span class=\"code-snippet__selector-tag\">TerminateBean<\/span>();<\/span><\/code><code><span class=\"code-snippet_outer\">    }<\/span><\/code><code><span class=\"code-snippet_outer\"><br  \/><\/span><\/code><code><span class=\"code-snippet_outer\">}<\/span><\/code><\/pre>\n<\/section>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><span style=\"outline: 0px;max-width: 100%;font-size: 16px;box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u5728\u542f\u52a8\u7c7b\u91cc\u8fb9\u8f93\u51fa\u4e00\u4e2a\u542f\u52a8\u65e5\u5fd7\uff0c\u5f53\u5de5\u7a0b\u542f\u52a8\u7684\u65f6\u5019\uff0c\u4f1a\u770b\u5230\u542f\u52a8\u7684\u8f93\u51fa\uff0c\u63a5\u4e0b\u6765\u54b1\u4eec\u6267\u884c\u505c\u6b62\u547d\u4ee4\u3002<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"javascript\"><code><span class=\"code-snippet_outer\">curl -X POST http:<span class=\"code-snippet__comment\">\/\/localhost:3333\/actuator\/shutdown<\/span><\/span><\/code><\/pre>\n<\/section>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><span style=\"font-size: 16px;letter-spacing: 0.544px;\">\u4ee5\u4e0b\u65e5\u5fd7\u53ef\u4ee5\u8f93\u51fa\u542f\u52a8\u65f6\u7684\u65e5\u5fd7\u6253\u5370\u548c\u505c\u6b62\u65f6\u7684\u65e5\u5fd7\u6253\u5370\uff0c\u540c\u65f6\u7a0b\u5e8f\u5df2\u7ecf\u505c\u6b62\u3002\u662f\u4e0d\u662f\u6bd4\u8f83\u795e\u5947\u3002<\/span><span style=\"letter-spacing: 0.544px;text-align: justify;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.1206896551724138\"  data-type=\"png\" data-w=\"2436\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528022354894.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.1206896551724138\"  data-type=\"png\" data-w=\"2436\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528022354894.png\"><\/noscript><\/span><\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><span style=\"outline: 0px;max-width: 100%;font-size: 16px;box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u7b2c\u4e8c\u79cd\u65b9\u6cd5\u4e5f\u6bd4\u8f83\u7b80\u5355\uff0c\u83b7\u53d6\u7a0b\u5e8f\u542f\u52a8\u65f6\u5019\u7684context\uff0c\u7136\u540e\u5173\u95ed\u4e3b\u7a0b\u5e8f\u542f\u52a8\u65f6\u7684context\u3002\u8fd9\u6837\u7a0b\u5e8f\u5728\u5173\u95ed\u7684\u65f6\u5019\u4e5f\u4f1a\u8c03\u7528PreDestroy\u6ce8\u89e3\u3002\u5982\u4e0b\u65b9\u6cd5\u5728\u7a0b\u5e8f\u542f\u52a8\u5341\u79d2\u540e\u8fdb\u884c\u5173\u95ed\u3002<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"swift\"><code><span class=\"code-snippet_outer\">&nbsp;&nbsp;&nbsp;<span class=\"code-snippet__comment\">\/*&nbsp;method&nbsp;2:&nbsp;use&nbsp;ctx.close&nbsp;to&nbsp;shutdown&nbsp;all&nbsp;application&nbsp;context&nbsp;*\/<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__type\">ConfigurableApplicationContext<\/span> ctx = <span class=\"code-snippet__type\">SpringApplication<\/span>.run(<span class=\"code-snippet__type\">ShutdowndemoApplication<\/span>.<span class=\"code-snippet__keyword\">class<\/span>, args);<\/span><\/code><code><span class=\"code-snippet_outer\"><br  \/><\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__keyword\">try<\/span> {<\/span><\/code><code><span class=\"code-snippet_outer\">            <span class=\"code-snippet__type\">TimeUnit<\/span>.<span class=\"code-snippet__type\">SECONDS<\/span>.sleep(<span class=\"code-snippet__number\">10<\/span>);<\/span><\/code><code><span class=\"code-snippet_outer\"><br  \/><\/span><\/code><code><span class=\"code-snippet_outer\">        } <span class=\"code-snippet__keyword\">catch<\/span> (<span class=\"code-snippet__type\">InterruptedException<\/span> e) {<\/span><\/code><code><span class=\"code-snippet_outer\">            e.printStackTrace();<\/span><\/code><code><span class=\"code-snippet_outer\">        }<\/span><\/code><code><span class=\"code-snippet_outer\"><br  \/><\/span><\/code><code><span class=\"code-snippet_outer\">        ctx.close();<\/span><\/code><\/pre>\n<\/section>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><span style=\"outline: 0px;max-width: 100%;font-size: 16px;box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u7b2c\u4e09\u79cd\u65b9\u6cd5\uff0c\u5728springboot\u542f\u52a8\u7684\u65f6\u5019\u5c06\u8fdb\u7a0b\u53f7\u5199\u5165\u4e00\u4e2aapp.pid\u6587\u4ef6\uff0c\u751f\u6210\u7684\u8def\u5f84\u662f\u53ef\u4ee5\u6307\u5b9a\u7684\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4 &nbsp;cat \/Users\/huangqingshi\/app.id | xargs kill \u547d\u4ee4\u76f4\u63a5\u505c\u6b62\u670d\u52a1\uff0c\u8fd9\u4e2a\u65f6\u5019bean\u5bf9\u8c61\u7684PreDestroy\u65b9\u6cd5\u4e5f\u4f1a\u8c03\u7528\u7684\u3002\u8fd9\u79cd\u65b9\u6cd5\u5927\u5bb6\u4f7f\u7528\u7684\u6bd4\u8f83\u666e\u904d\u3002\u5199\u4e00\u4e2astart.sh\u7528\u4e8e\u542f\u52a8springboot\u7a0b\u5e8f\uff0c\u7136\u540e\u5199\u4e00\u4e2a\u505c\u6b62\u7a0b\u5e8f\u5c06\u670d\u52a1\u505c\u6b62\u3002<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"javascript\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\">\/* method 3 : generate a pid in a specified path, while use command to shutdown pid :<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\">            'cat \/Users\/huangqingshi\/app.pid | xargs kill' *\/<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">        SpringApplication application = <span class=\"code-snippet__keyword\">new<\/span> SpringApplication(ShutdowndemoApplication.class);<\/span><\/code><code><span class=\"code-snippet_outer\">        application.addListeners(<span class=\"code-snippet__keyword\">new<\/span> ApplicationPidFileWriter(<span class=\"code-snippet__string\">\"\/Users\/huangqingshi\/app.pid\"<\/span>));<\/span><\/code><code><span class=\"code-snippet_outer\">        application.run();<\/span><\/code><\/pre>\n<\/section>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><span style=\"outline: 0px;max-width: 100%;font-size: 16px;box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u7b2c\u56db\u79cd\u65b9\u6cd5\uff0c\u901a\u8fc7\u8c03\u7528\u4e00\u4e2aSpringApplication.exit(\uff09\u65b9\u6cd5\u4e5f\u53ef\u4ee5\u9000\u51fa\u7a0b\u5e8f\uff0c\u540c\u65f6\u5c06\u751f\u6210\u4e00\u4e2a\u9000\u51fa\u7801\uff0c\u8fd9\u4e2a\u9000\u51fa\u7801\u53ef\u4ee5\u4f20\u9012\u7ed9\u6240\u6709\u7684context\u3002\u8fd9\u4e2a\u5c31\u662f\u4e00\u4e2aJVM\u7684\u94a9\u5b50\uff0c\u901a\u8fc7\u8c03\u7528\u8fd9\u4e2a\u65b9\u6cd5\u7684\u8bdd\u4f1a\u628a\u6240\u6709PreDestroy\u7684\u65b9\u6cd5\u6267\u884c\u5e76\u505c\u6b62\uff0c\u5e76\u4e14\u4f20\u9012\u7ed9\u5177\u4f53\u7684\u9000\u51fa\u7801\u7ed9\u6240\u6709Context\u3002\u901a\u8fc7\u8c03\u7528System.exit(exitCode)\u53ef\u4ee5\u5c06\u8fd9\u4e2a\u9519\u8bef\u7801\u4e5f\u4f20\u7ed9JVM\u3002\u7a0b\u5e8f\u6267\u884c\u5b8c\u540e\u6700\u540e\u4f1a\u8f93\u51fa\uff1aProcess finished with exit code 0\uff0c\u7ed9JVM\u4e00\u4e2aSIGNAL\u3002<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"cpp\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\">\/* method 4: exit this application using static method *\/<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">        ConfigurableApplicationContext ctx = SpringApplication.run(ShutdowndemoApplication.class, args);<\/span><\/code><code><span class=\"code-snippet_outer\">        exitApplication(ctx);<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">public<\/span> <span class=\"code-snippet__keyword\">static<\/span> <span class=\"code-snippet__keyword\">void<\/span> <span class=\"code-snippet__title\">exitApplication<\/span><span class=\"code-snippet__params\">(ConfigurableApplicationContext context)<\/span> <\/span>{<\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__keyword\">int<\/span> exitCode = SpringApplication.<span class=\"code-snippet__built_in\">exit<\/span>(context, (ExitCodeGenerator) () -&gt; <span class=\"code-snippet__number\">0<\/span>);<\/span><\/code><code><span class=\"code-snippet_outer\"><br  \/><\/span><\/code><code><span class=\"code-snippet_outer\">        System.<span class=\"code-snippet__built_in\">exit<\/span>(exitCode);<\/span><\/code><code><span class=\"code-snippet_outer\">    }<\/span><\/code><\/pre>\n<\/section>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><span style=\"outline: 0px;max-width: 100%;font-size: 16px;box-sizing: border-box !important;overflow-wrap: break-word !important;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.14543960558751026\"  data-type=\"png\" data-w=\"2434\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528022359571.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.14543960558751026\"  data-type=\"png\" data-w=\"2434\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528022359571.png\"><\/noscript>\u7b2c\u4e94\u79cd\u65b9\u6cd5\uff0c\u81ea\u5df1\u5199\u4e00\u4e2aController\uff0c\u7136\u540e\u5c06\u81ea\u5df1\u5199\u597d\u7684Controller\u83b7\u53d6\u5230\u7a0b\u5e8f\u7684context\uff0c\u7136\u540e\u8c03\u7528\u81ea\u5df1\u914d\u7f6e\u7684Controller\u65b9\u6cd5\u9000\u51fa\u7a0b\u5e8f\u3002\u901a\u8fc7\u8c03\u7528\u81ea\u5df1\u5199\u7684\/shutDownContext\u65b9\u6cd5\u5173\u95ed\u7a0b\u5e8f\uff1acurl -X POST http:\/\/localhost:3333\/shutDownContext\u3002<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"kotlin\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">import<\/span> org.springframework.beans.BeansException;<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">import<\/span> org.springframework.context.ApplicationContext;<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">import<\/span> org.springframework.context.ApplicationContextAware;<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">import<\/span> org.springframework.context.ConfigurableApplicationContext;<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">import<\/span> org.springframework.web.bind.<span class=\"code-snippet__keyword\">annotation<\/span>.GetMapping;<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">import<\/span> org.springframework.web.bind.<span class=\"code-snippet__keyword\">annotation<\/span>.PostMapping;<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">import<\/span> org.springframework.web.bind.<span class=\"code-snippet__keyword\">annotation<\/span>.RestController;<\/span><\/code><code><span class=\"code-snippet_outer\"><br  \/><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__meta\">@RestController<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">publicclass ShutDownController implements ApplicationContextAware {<\/span><\/code><code><span class=\"code-snippet_outer\"><br  \/><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__keyword\">private<\/span> ApplicationContext context;<\/span><\/code><code><span class=\"code-snippet_outer\"><br  \/><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__meta\">@PostMapping(<span class=\"code-snippet__meta-string\">\"\/shutDownContext\"<\/span>)<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__keyword\">public<\/span> String shutDownContext() {<\/span><\/code><code><span class=\"code-snippet_outer\">        ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) context;<\/span><\/code><code><span class=\"code-snippet_outer\">        ctx.close();<\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__keyword\">return<\/span><span class=\"code-snippet__string\">\"context is shutdown\"<\/span>;<\/span><\/code><code><span class=\"code-snippet_outer\">    }<\/span><\/code><code><span class=\"code-snippet_outer\"><br  \/><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__meta\">@GetMapping(<span class=\"code-snippet__meta-string\">\"\/\"<\/span>)<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__keyword\">public<\/span> String getIndex() {<\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__keyword\">return<\/span><span class=\"code-snippet__string\">\"OK\"<\/span>;<\/span><\/code><code><span class=\"code-snippet_outer\">    }<\/span><\/code><code><span class=\"code-snippet_outer\"><br  \/><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__meta\">@Override<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__keyword\">public<\/span> void setApplicationContext(ApplicationContext applicationContext) throws BeansException {<\/span><\/code><code><span class=\"code-snippet_outer\">        context = applicationContext;<\/span><\/code><code><span class=\"code-snippet_outer\">    }<\/span><\/code><code><span class=\"code-snippet_outer\">}<\/span><\/code><\/pre>\n<\/section>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><span style=\"outline: 0px;max-width: 100%;font-size: 16px;box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u597d\u4e86\uff0cspringboot\u7684\u4f18\u96c5\u5173\u95ed\u65b9\u6cd5\u4e5f\u90fd\u5b9e\u73b0\u597d\u4e86\uff0c\u4e5f\u6709\u540c\u5b66\u95ee\uff0c\u5982\u4f55\u66b4\u529b\u505c\u6b62\u5462\uff0c\u7b80\u5355\uff0c\u76f4\u63a5kill -9 \u76f8\u5e94\u7684PID\u5373\u53ef\u3002<\/span><\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><strong style=\"outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;\"><span style=\"outline: 0px;max-width: 100%;font-size: 20px;box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u603b\u7ed3\u4e00\u4e0b<\/span><\/strong><\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><span style=\"outline: 0px;max-width: 100%;font-size: 16px;box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u4ee5\u4e0a\u8fd9\u51e0\u79cd\u65b9\u6cd5\u5b9e\u73b0\u7684\u8bdd\u6bd4\u8f83\u7b80\u5355\uff0c\u4f46\u662f\u771f\u5b9e\u5de5\u4f5c\u4e2d\u8fd8\u9700\u8981\u8003\u8651\u7684\u70b9\u8fd8\u5f88\u591a\uff0c\u6bd4\u5982\u9700\u8981\u4fdd\u62a4\u66b4\u9732\u7684\u70b9\u4e0d\u88ab\u522b\u4eba\u5229\u7528\uff0c\u4e00\u822c\u8981\u52a0\u4e00\u4e9b\u9632\u706b\u5899\uff0c\u6216\u8005\u53ea\u5728\u5185\u7f51\u4f7f\u7528\uff0c\u4fdd\u8bc1\u7a0b\u5e8f\u5b89\u5168\u3002<\/span><\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;outline: 0px;max-width: 100%;color: rgba(0, 0, 0, 0.9);font-family: system-ui, -apple-system, 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;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;\"><span style=\"outline: 0px;max-width: 100%;font-size: 16px;box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u5728\u771f\u5b9e\u7684\u5de5\u4f5c\u4e2d\u7684\u65f6\u5019\u7b2c\u4e09\u79cd\u6bd4\u8f83\u5e38\u7528\uff0c\u7a0b\u5e8f\u4e2d\u4e00\u822c\u4f7f\u7528\u5185\u5b58\u961f\u5217\u6216\u7ebf\u7a0b\u6c60\u7684\u65f6\u5019\u6700\u597d\u8981\u4f18\u96c5\u7684\u5173\u673a\uff0c\u5c06\u5185\u5b58\u961f\u5217\u6ca1\u6709\u5904\u7406\u7684\u4fdd\u5b58\u8d77\u6765\u6216\u7ebf\u7a0b\u6c60\u4e2d\u6ca1\u5904\u7406\u5b8c\u7684\u7a0b\u5e8f\u5904\u7406\u5b8c\u3002\u4f46\u662f\u56e0\u4e3a\u505c\u673a\u7684\u65f6\u5019\u6bd4\u8f83\u5feb\uff0c\u6240\u4ee5\u505c\u670d\u52a1\u7684\u65f6\u5019\u6700\u597d\u4e0d\u8981\u5904\u7406\u5927\u91cf\u7684\u6570\u636e\u64cd\u4f5c\uff0c\u8fd9\u6837\u4f1a\u5f71\u54cd\u7a0b\u5e8f\u505c\u6b62\u3002<\/span><\/p>\n<section><mp-common-profile class=\"js_uneditable custom_select_card mp_profile_iframe\" data-pluginname=\"mpprofile\" data-weui-theme=\"light\" data-id=\"MjM5NDQ4MzA1Nw==\" data-headimg=\"http:\/\/mmbiz.qpic.cn\/mmbiz_png\/7OPxOA8ic5m8iaZhZuawOQpg1kY6p7DsNdHYUDLY6XBfZYualr95vI5BKic0SbnZ7lzkibwdTfLmFkx9flmoEvLQiaQ\/0?wx_fmt=png\" data-nickname=\"IT\u725b\u5ba2\" data-alias=\"\" data-signature=\"\u4e13\u6ce8\u4e8eIT\u6280\u672f\u5206\u4eab\uff0c\u539f\u521b\u6280\u672f\u548c\u521b\u65b0\u6280\u672f\u5206\u4eab\uff0cIT\u725b\u5ba2\uff0c\u6211\u4eec\u4e00\u8d77\u8fdb\u6b65\u2026\u2026\" data-from=\"0\" data-is_biz_ban=\"0\"><\/mp-common-profile><\/section>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;max-width: 100%;letter-spacing: 0.544px;font-size: 16px;background-color: rgb(255, 255, 255);color: rgb(63, 63, 63);text-align: left;box-sizing: border-box !important;overflow-wrap: break-word !important;\"><p style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;max-width: 100%;letter-spacing: 0.544px;white-space: normal;color: rgb(62, 62, 62);text-align: center;widows: 1;word-spacing: 2px;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;line-height: 2em;box-sizing: border-box !important;overflow-wrap: break-word !important;\"><span style=\"outline: 0px;max-width: 100%;font-size: 13px;letter-spacing: 0.5px;color: rgb(0, 128, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;\"><span style=\"outline: 0px;max-width: 100%;font-family: -apple-system-font, 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;box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u5982\u559c\u6b22\u672c\u6587\uff0c\u8bf7\u70b9\u51fb\u53f3\u4e0a\u89d2\uff0c\u628a\u6587\u7ae0\u5206\u4eab\u5230\u670b\u53cb\u5708<\/span><br style=\"outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;\"  \/><\/span><\/p><p style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;max-width: 100%;letter-spacing: 0.544px;white-space: normal;color: rgb(62, 62, 62);text-align: center;widows: 1;word-spacing: 2px;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;line-height: 2em;box-sizing: border-box !important;overflow-wrap: break-word !important;\"><strong style=\"outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;\"><span style=\"outline: 0px;max-width: 100%;font-family: -apple-system-font, 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;font-size: 13px;letter-spacing: 0.5px;color: rgb(217, 33, 66);box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u56e0\u516c\u4f17\u53f7\u66f4\u6539\u63a8\u9001\u89c4\u5219\uff0c\u8bf7\u70b9\u201c\u5728\u770b\u201d\u5e76\u52a0\u201c\u661f\u6807\u201d<span style=\"outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u7b2c\u4e00\u65f6\u95f4\u83b7\u53d6\u7cbe\u5f69\u6280\u672f\u5206\u4eab<\/span><\/span><\/strong><\/p><p style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;max-width: 100%;letter-spacing: 0.544px;white-space: normal;color: rgb(62, 62, 62);text-align: center;widows: 1;word-spacing: 2px;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;line-height: 2em;box-sizing: border-box !important;overflow-wrap: break-word !important;\"><strong style=\"outline: 0px;max-width: 100%;letter-spacing: 0.544px;font-family: \u5fae\u8f6f\u96c5\u9ed1;font-size: 16.3636px;box-sizing: border-box !important;overflow-wrap: break-word !important;\">\u00b7END\u00b7<\/strong><\/p><\/pre>\n<p style=\"display: none;\"><mp-style-type data-value=\"3\"><\/mp-style-type><\/p>\n<blockquote>\n<p>\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e\u5fae\u4fe1\u516c\u4f17\u53f7:                 IT\u725b\u5ba2              <\/p>\n<\/blockquote>\n<\/div>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\uff1acnblogs.com\/huangqingshi\/p\/11370291.html \u5728\u4f7f\u7528Springboot\u7684\u65f6\u5019\uff0c\u90fd\u8981\u6d89\u53ca &#8230;<\/p>\n","protected":false},"author":1,"featured_media":1075,"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-1079","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring-boot"],"post_thumbnail_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528022353531-150x150.jpeg","content_first_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528022354894.png","post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528022353531.jpeg","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528022353531.jpeg","post_frist_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528022354894.png","post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528022353531.jpeg","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528022353531.jpeg","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528022353531.jpeg","post_all_images":[{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528022354894.png","id":"image0"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528022354894.png","id":"image1"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528022359571.png","id":"image2"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528022359571.png","id":"image3"}],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"Spring Boot","post_date":"2023-05-27","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":322,"next_post_id":1025,"next_post_title":"SpringBoot \u5185\u7f6e\u5de5\u5177\u7c7b","previous_post_id":903,"previous_post_title":"Spring-14 AOP CGLIB \u4ee3\u7406\u5bf9\u8c61\u6e90\u7801","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/1079","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=1079"}],"version-history":[{"count":0,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/1079\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media\/1075"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1079"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1079"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1079"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}