{"id":5378,"date":"2024-08-01T22:47:32","date_gmt":"2024-08-01T14:47:32","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=5378"},"modified":"2024-08-02T16:05:08","modified_gmt":"2024-08-02T08:05:08","slug":"%e8%af%b7%e7%89%a2%e8%ae%b0springboot%e8%bf%997%e4%b8%aa%e5%bc%ba%e5%a4%a7%e7%9a%84%e9%9a%90%e8%97%8fbean","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/spring-boot\/%e8%af%b7%e7%89%a2%e8%ae%b0springboot%e8%bf%997%e4%b8%aa%e5%bc%ba%e5%a4%a7%e7%9a%84%e9%9a%90%e8%97%8fbean\/","title":{"rendered":"\u8bf7\u7262\u8bb0SpringBoot\u8fd97\u4e2a\u5f3a\u5927\u7684\u9690\u85cfBean"},"content":{"rendered":"<div class=\"wxsyncmain\">\n<section class=\"mp_profile_iframe_wrp\" data-mpa-powered-by=\"yiban.io\"><\/section>\n<p><span style=\"font-size: 15px;\">\u73af\u5883\uff1aSpringBoot2.7.18<\/span><\/p>\n<hr style=\"border-style: solid; border-width: 1px 0 0; border-color: rgba(0,0,0,0.1); -webkit-transform-origin: 0 0; -webkit-transform: scale(1, 0.5); transform-origin: 0 0; transform: scale(1, 0.5);\" \/>\n<p><strong><span style=\"font-size: 16px; display: inline-table; box-sizing: border-box; transform-style: preserve-3d; text-indent: 0em;\"><span style=\"color: rgba(0, 0, 0, 0.9); transform: translate3d(0px, 0px, 1px); display: inline-block; font-weight: bold;\"><span style=\"display: inline-table; box-sizing: border-box; transform-style: preserve-3d; text-indent: 0em;\" data-mpa-emphasize-underline=\"t\"><span style=\"font-size: 16px; color: rgba(0, 0, 0, 0.9); transform: translate3d(0px, 0px, 1px); display: inline-block; font-weight: bold;\">1. \u5e94\u7528\u7a0b\u5e8f\u53c2\u6570<\/span><\/span><\/span><\/span><\/strong><\/p>\n<p><span style=\"font-size: 15px;\">SpringBoot\u7a0b\u5e8f\u5728\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u65b9\u5f0f\u8bbe\u7f6e\u542f\u52a8\u53c2\u6570\uff1a<\/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=\"nginx\"><code><span class=\"code-snippet_outer\">java-jarapp.jar--pack.title=xxx--pack.version=1.0.0<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px;\">\u4e00\u822c\u8bbf\u95ee\u4e0a\u9762\u7684\u53c2\u6570\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u65b9\u5f0f\uff1a<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"css\"><code><span class=\"code-snippet_outer\">@Resource<\/span><\/code><code><span class=\"code-snippet_outer\">private Environment env ;<\/span><\/code><code><span class=\"code-snippet_outer\">public void getArgs() {<\/span><\/code><code><span class=\"code-snippet_outer\">Stringtitle=env.getProperty(\"pack.title\");<\/span><\/code><code><span class=\"code-snippet_outer\">String version = env.getProperty(\"pack.version\");<\/span><\/code><code><span class=\"code-snippet_outer\">}<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px;\">\u5176\u5b9eSpringBoot\u4e3a\u6211\u4eec\u6ce8\u518c\u4e86\u4e00\u4e2aBean\u5bf9\u8c61<\/span><span style=\"font-size: 15px; color: #ff0000;\"><strong><span style=\"background-color: #ffffff; padding-left: 2px; font-family: Consolas; white-space-collapse: preserve;\">ApplicationArguments<\/span><\/strong><\/span><span style=\"background-color: #ffffff; padding-left: 2px; font-size: 15px; color: #000000; font-family: Consolas; white-space-collapse: preserve;\">\uff0c\u5728\u4ee3\u7801\u4e2d\u53ef\u4ee5\u76f4\u63a5\u6ce8\u5165\u8be5\u5bf9\u8c61<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"css\"><code><span class=\"code-snippet_outer\">@Resource<\/span><\/code><code><span class=\"code-snippet_outer\">private ApplicationArguments applicationArguments ;<\/span><\/code><code><span class=\"code-snippet_outer\">public void getArgs() {<\/span><\/code><code><span class=\"code-snippet_outer\">  List&lt;String&gt; titles = applicationArguments.getOptionValues(\"pack.title\") ;<\/span><\/code><code><span class=\"code-snippet_outer\">List&lt;String&gt;version=applicationArguments.getOptionValues(\"pack.version\");<\/span><\/code><code><span class=\"code-snippet_outer\">}<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px;\">\u6211\u4eec\u8fd8\u53ef\u4ee5\u62ff\u5230\u539f\u59cb\u914d\u7f6e\u7684\u53c2\u6570\u4fe1\u606f<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"css\"><code><span class=\"code-snippet_outer\">String[]args=applicationArguments.getSourceArgs();<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px;\">\u8f93\u51fa\u7ed3\u679c<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"json\"><code><span class=\"code-snippet_outer\">[--pack.title=xxx, --pack.version=1.0.0]<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px;\">\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u8981\u8fdb\u884c\u89e3\u6790\u5904\u7406\u3002<\/span><\/p>\n<p><strong><span style=\"font-size: 16px; display: inline-table; box-sizing: border-box; transform-style: preserve-3d; text-indent: 0em;\"><span style=\"color: rgba(0, 0, 0, 0.9); transform: translate3d(0px, 0px, 1px); display: inline-block; font-weight: bold;\"><span style=\"display: inline-table; box-sizing: border-box; transform-style: preserve-3d; text-indent: 0em;\" data-mpa-emphasize-underline=\"t\"><span style=\"font-size: 16px; color: rgba(0, 0, 0, 0.9); transform: translate3d(0px, 0px, 1px); display: inline-block; font-weight: bold;\">2. Banner<\/span><\/span><\/span><\/span><\/strong><\/p>\n<p><span style=\"font-size: 15px;\">\u5982\u679c\u4f60\u60f3\u5728\u9879\u76ee\u4e2d\u83b7\u53d6Banner\u4fe1\u606f\uff0c\u90a3\u4e48\u4f60\u53ef\u4ee5\u76f4\u63a5\u5728\u4ee3\u7801\u4e2d\u6ce8\u5165<span style=\"color: #ff0000;\"><strong>Banner<\/strong><\/span>\u5bf9\u8c61\u3002<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"css\"><code><span class=\"code-snippet_outer\">@Resource<\/span><\/code><code><span class=\"code-snippet_outer\">private Banner banner ;<\/span><\/code><code><span class=\"code-snippet_outer\">@Resource<\/span><\/code><code><span class=\"code-snippet_outer\">private Environment env ;<\/span><\/code><code><span class=\"code-snippet_outer\">publicvoidprintBanner() {<\/span><\/code><code><span class=\"code-snippet_outer\">banner.printBanner(env,PackApplication.class,System.out);<\/span><\/code><code><span class=\"code-snippet_outer\">}<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px;\">\u6ce8\u610f\uff1a\u786e\u4fdd\u4f60\u6ca1\u6709\u5173\u95edBanner\uff0c\u4e5f\u5c31\u662f\u8bf4\u4f60\u6ca1\u6709\u8fdb\u884c\u5982\u4e0b\u7684\u914d\u7f6e\u3002<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"properties\"><code><span class=\"code-snippet_outer\">spring:<\/span><\/code><code><span class=\"code-snippet_outer\">  main:<\/span><\/code><code><span class=\"code-snippet_outer\">banner-mode:off#\u5173\u95edBanner<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px;\">\u7f16\u7a0b\u65b9\u5f0f<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"javascript\"><code><span class=\"code-snippet_outer\">SpringApplication app = new SpringApplication(PackApplication.class);<\/span><\/code><code><span class=\"code-snippet_outer\">app.setBannerMode(Mode.OFF) ;<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px;\">\u5982\u679c\u4f60\u5173\u95ed\u4e86Banner\uff0c\u90a3\u4e48\u4e0a\u9762\u7684\u6ce8\u5165\u5c06\u4f1a\u62a5\u9519\u3002<\/span><\/p>\n<p><strong><span style=\"font-size: 16px; display: inline-table; box-sizing: border-box; transform-style: preserve-3d; text-indent: 0em;\"><span style=\"color: rgba(0, 0, 0, 0.9); transform: translate3d(0px, 0px, 1px); display: inline-block; font-weight: bold;\"><span style=\"display: inline-table; box-sizing: border-box; transform-style: preserve-3d; text-indent: 0em;\" data-mpa-emphasize-underline=\"t\"><span style=\"font-size: 16px; color: rgba(0, 0, 0, 0.9); transform: translate3d(0px, 0px, 1px); display: inline-block; font-weight: bold;\">3. \u7c7b\u578b\u8f6c\u6362\u5668<\/span><\/span><\/span><\/span><\/strong><\/p>\n<p><span style=\"background-color: #ffffff; padding-left: 2px; color: #000000; font-family: Consolas; font-size: 12pt; white-space-collapse: preserve;\">ConversionService<\/span><span style=\"font-size: 15px; letter-spacing: 0.034em;\">\u662f\u4e2a\u975e\u5e38\u91cd\u8981\u53ca\u5f3a\u5927\u7684\u7c7b\uff0c\u8be5\u7c7b\u5728SpringBoot\u542f\u52a8\u8fc7\u7a0b\u4e2d\u5c06\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u914d\u7f6e\u6570\u636e\u8f6c\u6362\u4e3a\u5bf9\u5e94\u7684\u6570\u636e\u7c7b\u578b\u3002Controller\u8bf7\u6c42\u53c2\u6570\u6570\u636e\u7c7b\u578b\u8fdb\u884c\u8f6c\u6362\u3002\u5728\u4ee3\u7801\u4e2d\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u6ce8\u5165\u8be5\u7c7b\uff0c\u5982\u4e0b\u793a\u4f8b\uff1a<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"css\"><code><span class=\"code-snippet_outer\">@Resource<\/span><\/code><code><span class=\"code-snippet_outer\">private ConversionService conversionService ;<\/span><\/code><code><span class=\"code-snippet_outer\">Integer ret = conversionService.convert(\"6666\", <\/span><\/code><code><span class=\"code-snippet_outer\">  TypeDescriptor.valueOf(String.class), <\/span><\/code><code><span class=\"code-snippet_outer\">  TypeDescriptor.valueOf(Integer.class)) ;<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px;\">\u4f60\u4e5f\u53ef\u4ee5\u6ce8\u518c\u81ea\u5b9a\u4e49\u7684\u7c7b\u578b\u8f6c\u6362<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"typescript\"><code><span class=\"code-snippet_outer\">@Configuration<\/span><\/code><code><span class=\"code-snippet_outer\">publicclassWebConfigimplementsWebMvcConfigurer{<\/span><\/code><code><span class=\"code-snippet_outer\">  @Override<\/span><\/code><code><span class=\"code-snippet_outer\">  public void addFormatters(FormatterRegistry registry) {<\/span><\/code><code><span class=\"code-snippet_outer\">    registry.addConverterFactory(new ConverterFactory&lt;String, User&gt;() {<\/span><\/code><code><span class=\"code-snippet_outer\">      @Override<\/span><\/code><code><span class=\"code-snippet_outer\">      public &lt;T extends User&gt; Converter&lt;String, T&gt; getConverter(Class&lt;T&gt; targetType) {<\/span><\/code><code><span class=\"code-snippet_outer\">        return new Converter&lt;String, T&gt;() {<\/span><\/code><code><span class=\"code-snippet_outer\">          @Override<\/span><\/code><code><span class=\"code-snippet_outer\">          public T convert(String source) {<\/span><\/code><code><span class=\"code-snippet_outer\">            String[] s = source.split(\",\") ;<\/span><\/code><code><span class=\"code-snippet_outer\">            return (T) new User(Integer.valueOf(s[0]), s[1]) ;<\/span><\/code><code><span class=\"code-snippet_outer\">          }<\/span><\/code><code><span class=\"code-snippet_outer\">        } ;<\/span><\/code><code><span class=\"code-snippet_outer\">      }<\/span><\/code><code><span class=\"code-snippet_outer\">    }) ;<\/span><\/code><code><span class=\"code-snippet_outer\">  }<\/span><\/code><code><span class=\"code-snippet_outer\">}<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px;\">\u6dfb\u52a0\u81ea\u5b9a\u4e49\u7c7b\u578b\u8f6c\u6362\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u4ee3\u7801\u4e2d\u81ea\u5df1\u901a\u8fc7<\/span><span style=\"font-size: 15px; color: #ff0000;\"><strong><span style=\"font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; letter-spacing: 0.578px; text-align: left; white-space-collapse: preserve; background-color: #fafafa;\">ConversionService<\/span><\/strong><\/span><span style=\"font-size: 15px; letter-spacing: 0.034em;\">\u8fdb\u884c\u7c7b\u578b\u8f6c\u6362\u3002<\/span><\/p>\n<p><strong><span style=\"font-size: 16px; display: inline-table; box-sizing: border-box; transform-style: preserve-3d; text-indent: 0em;\"><span style=\"color: rgba(0, 0, 0, 0.9); transform: translate3d(0px, 0px, 1px); display: inline-block; font-weight: bold;\"><span style=\"display: inline-table; box-sizing: border-box; transform-style: preserve-3d; text-indent: 0em;\" data-mpa-emphasize-underline=\"t\"><span style=\"font-size: 16px; color: rgba(0, 0, 0, 0.9); transform: translate3d(0px, 0px, 1px); display: inline-block; font-weight: bold;\">4. Servlet\u76f8\u5173\u5bf9\u8c61<\/span><\/span><\/span><\/span><\/strong><\/p>\n<p><span style=\"font-size: 15px;\">SpringBoot\u542f\u52a8\u8fc7\u7a0b\u4e2d\u4f1a\u6ce8\u518c\u4ee5\u4e0b4\u4e2a\u4e0eWeb\u76f8\u5173\u7684Bean\u5bf9\u8c61\u3002<\/span><\/p>\n<ul class=\"list-paddingleft-1\" style=\"list-style-type: disc;\">\n<li style=\"font-size: 15px;\"><span style=\"background-color: #ffffff; padding-left: 2px; color: #000000; font-family: Consolas; white-space-collapse: preserve; font-size: 15px;\">ServletRequest<\/span><\/li>\n<li style=\"font-size: 15px;\"><span style=\"background-color: #ffffff; padding-left: 2px; color: #000000; font-family: Consolas; white-space-collapse: preserve; font-size: 15px;\">ServletResponse<\/span><\/li>\n<li style=\"font-size: 15px;\"><span style=\"background-color: #ffffff; padding-left: 2px; color: #000000; font-family: Consolas; white-space-collapse: preserve; font-size: 15px;\">HttpSession<\/span><\/li>\n<li style=\"font-size: 15px;\"><span style=\"background-color: #ffffff; padding-left: 2px; color: #000000; font-family: Consolas; white-space-collapse: preserve; font-size: 15px;\">WebRequest<\/span><\/li>\n<\/ul>\n<p><span style=\"font-size: 15px;\">\u8fd94\u4e2a\u5bf9\u8c61\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u4ee3\u7801\u4e2d\u4efb\u610f\u7684\u6ce8\u5165\uff0c\u800c\u4e0d\u5fc5\u62c5\u5fc3\u7ebf\u7a0b\u5b89\u5168\u95ee\u9898\u3002\u56e0\u4e3a\u8fd9\u4e9b\u5bf9\u8c61\u5b9e\u9645\u5bf9\u5e94\u7684\u662f<\/span><span style=\"color: #ff0000;\"><strong><span style=\"background-color: #ffffff; padding-left: 2px; font-family: Consolas; white-space-collapse: preserve; font-size: 15px;\">ObjectFactory<\/span><\/strong><\/span><span style=\"background-color: #ffffff; padding-left: 2px; color: #000000; font-family: Consolas; white-space-collapse: preserve; font-size: 15px;\">\u3002\u800c\u5bf9\u5e94\u7684\u5185\u90e8\u5b9e\u73b0\u662f\u4eceThreadLocal\u4e2d\u83b7\u53d6\u3002\u5982\u4e0b\u793a\u4f8b\uff1a<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"cs\"><code><span class=\"code-snippet_outer\">@Resource<\/span><\/code><code><span class=\"code-snippet_outer\">privateHttpServletRequest request ;<\/span><\/code><code><span class=\"code-snippet_outer\">@Resource<\/span><\/code><code><span class=\"code-snippet_outer\">private HttpServletResponse response ;<\/span><\/code><code><\/code><code><span class=\"code-snippet_outer\">publicvoidgetParam() {<\/span><\/code><code><span class=\"code-snippet_outer\">  String value = request.getParameter(\"name\") ;<\/span><\/code><code><span class=\"code-snippet_outer\">}<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px;\">\u6bcf\u4e2a\u8bf7\u6c42\u5230\u6765\u65f6\u90fd\u4f1a\u5c06\u5f53\u524d\u5bf9\u5e94\u7684Request\u5b58\u5165\u5230ThreadLocal\u4e2d\u3002<\/span><\/p>\n<p><strong><span style=\"font-size: 16px; display: inline-table; box-sizing: border-box; transform-style: preserve-3d; text-indent: 0em;\"><span style=\"color: rgba(0, 0, 0, 0.9); transform: translate3d(0px, 0px, 1px); display: inline-block; font-weight: bold;\"><span style=\"display: inline-table; box-sizing: border-box; transform-style: preserve-3d; text-indent: 0em;\" data-mpa-emphasize-underline=\"t\"><span style=\"font-size: 16px; color: rgba(0, 0, 0, 0.9); transform: translate3d(0px, 0px, 1px); display: inline-block; font-weight: bold;\">5.\u56fd\u9645\u5316MessageSource<\/span><\/span><\/span><\/span><\/strong><\/p>\n<p><span style=\"font-size: 15px;\">\u6211\u4eec\u53ef\u4ee5\u5728\u4ee3\u7801\u4e2d\u76f4\u63a5\u6ce8\u5165<span style=\"color: #ff0000;\"><strong>MessageSource<\/strong><\/span>\u5bf9\u8c61\uff0c\u8fdb\u884c\u56fd\u9645\u5316\u8d44\u6e90\u7684\u8bbf\u95ee\uff0c\u5982\u4e0b\u793a\u4f8b\uff1a<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"css\"><code><span class=\"code-snippet_outer\">@Resource<\/span><\/code><code><span class=\"code-snippet_outer\">private MessageSource messageSource ;<\/span><\/code><code><span class=\"code-snippet_outer\">publicvoidgetMsg() {<\/span><\/code><code><span class=\"code-snippet_outer\">  String message = this.messageSource.getMessage(\"pack.info.message\", <\/span><\/code><code><span class=\"code-snippet_outer\">    new Object[] {\"\u5f20\u4e09\"}, \"\u6211\u662f\u9ed8\u8ba4\u6d88\u606f\", Locale.CHINA) ;<\/span><\/code><code><span class=\"code-snippet_outer\">}<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px;\">\u4e0a\u9762\u4ee3\u7801\u5982\u679c\u4f60\u6ca1\u6709\u8bbe\u7f6e\u9ed8\u8ba4\u6d88\u606f\uff0c\u90a3\u4e48\u4f1a\u62a5\u9519\uff0c\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0bSpring\u5b9e\u4f8b\u5316\u7684MessageSource\u5bf9\u8c61\u662f<\/span><strong><span style=\"font-size: 15px; color: #ff0000;\">DelegatingMessageSource<\/span><\/strong><span style=\"font-size: 15px; letter-spacing: 0.034em;\">\u8fd9\u662f\u4e00\u4e2a\u7a7a\u7684\u5b9e\u73b0\u3002\u8981\u80fd\u4f7f\u7684\u6211\u4eec\u7684\u56fd\u9645\u5316\u8d44\u6e90\u751f\u6548\uff0c\u4f60\u8fd8\u9700\u8981\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u8fdb\u884c\u5982\u4e0b\u914d\u7f6e\uff1a<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"properties\"><code><span class=\"code-snippet_outer\">spring:<\/span><\/code><code><span class=\"code-snippet_outer\">  messages:<\/span><\/code><code><span class=\"code-snippet_outer\">basename:i18n\/message#\u8fd9\u91cc\u6839\u636e\u81ea\u5df1\u5b9e\u9645\u60c5\u51b5\u81ea\u5b9a\u4e49basename<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px;\">\u8fd9\u6837\u914d\u7f6e\u540e\uff0cSpringBoot\u4f1a\u81ea\u52a8\u6ce8\u518c<\/span><span style=\"font-size: 15px; color: #ff0000;\"><strong><span style=\"background-color: #ffffff; padding-left: 2px; font-family: Consolas; white-space-collapse: preserve;\">ResourceBundleMessageSource<\/span><\/strong><\/span><span style=\"font-size: 15px; letter-spacing: 0.034em;\">\u5bf9\u8c61\u3002<\/span><\/p>\n<p><span style=\"font-size: 15px; letter-spacing: 0.034em;\">\u5176\u5b9e\u6211\u4eec\u4e5f\u53ef\u4ee5\u4e0d\u4f7f\u7528MessageSource\uff0c\u800c\u76f4\u63a5\u6ce8\u5165ApplicationContext\u5bf9\u8c61\uff0c\u5982\u4e0b\u793a\u4f8b\uff1a<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"css\"><code><span class=\"code-snippet_outer\">@Resource<\/span><\/code><code><span class=\"code-snippet_outer\">private ConfigurableApplicationContext context ;<\/span><\/code><code><\/code><code><span class=\"code-snippet_outer\">Stringmessage = context.getMessage(\"pack.info.message\", <\/span><\/code><code><span class=\"code-snippet_outer\">  new Object[] {\"\u5f20\u4e09\"}, \"\u6211\u662f\u9ed8\u8ba4\u6d88\u606f\", Locale.CHINA) ;<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px;\">\u901a\u8fc7ApplicationContext\u5bf9\u8c61\u83b7\u53d6\u8d44\u6e90\u6d88\u606f\uff0c\u8d77\u5185\u90e8\u8fd8\u662f\u4f7f\u7528\u7684\u4e0a\u9762\u7684MessageSource\u3002<\/span><\/p>\n<p><strong><span style=\"font-size: 16px; display: inline-table; box-sizing: border-box; transform-style: preserve-3d; text-indent: 0em;\"><span style=\"color: rgba(0, 0, 0, 0.9); transform: translate3d(0px, 0px, 1px); display: inline-block; font-weight: bold;\"><span style=\"display: inline-table; box-sizing: border-box; transform-style: preserve-3d; text-indent: 0em;\" data-mpa-emphasize-underline=\"t\"><span style=\"font-size: 16px; color: rgba(0, 0, 0, 0.9); transform: translate3d(0px, 0px, 1px); display: inline-block; font-weight: bold;\">6.\u4e8b\u4ef6\u53d1\u5e03\u5bf9\u8c61<\/span><\/span><\/span><\/span><\/strong><\/p>\n<p><span style=\"font-size: 15px;\">\u5728\u9879\u76ee\u4e2d\u4f60\u8981\u53d1\u5e03\u4e8b\u4ef6\u4f60\u53ef\u4ee5\u901a\u8fc7ApplicationContext\u5bf9\u8c61\u6765\u53d1\u5e03\uff0c\u5982\u4e0b\u793a\u4f8b\uff1a<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"css\"><code><span class=\"code-snippet_outer\">@Resource<\/span><\/code><code><span class=\"code-snippet_outer\">private ConfigurableApplicationContext context ;<\/span><\/code><code><span class=\"code-snippet_outer\">\/\/ \u53d1\u5e03\u4e8b\u4ef6<\/span><\/code><code><span class=\"code-snippet_outer\">context.publishEvent(new TxApplicationEvent(context)) ;<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px;\">\u4e00\u822c\u5728\u9879\u76ee\u4e2d\u901a\u8fc7\u4e0a\u9762\u7684\u65b9\u5f0f\u53d1\u5e03\u4e00\u4e2a\u4e8b\u4ef6\u3002\u800c\u5b9e\u9645Spring\u4e3a\u6211\u4eec\u8fd8\u6ce8\u518c\u4e86\u4e00\u4e2a<\/span><span style=\"font-size: 15px; color: #ff0000;\"><strong><span style=\"background-color: #ffffff; padding-left: 2px; font-family: Consolas; white-space-collapse: preserve;\">ApplicationEventMulticaster<\/span><\/strong><\/span><span style=\"font-size: 15px; letter-spacing: 0.034em;\">\u5bf9\u8c61\uff0c\u8be5\u5bf9\u8c61\u4e13\u95e8\u7528\u6765\u5e7f\u64ad\u4e8b\u4ef6\u3002<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"css\"><code><span class=\"code-snippet_outer\">@Resource<\/span><\/code><code><span class=\"code-snippet_outer\">private ApplicationEventMulticaster eventMulticast ;<\/span><\/code><code><span class=\"code-snippet_outer\">eventMulticast.multicastEvent(newTxApplicationEvent(context));<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px;\">\u6211\u4eec\u4e5f\u53ef\u4ee5\u81ea\u5b9a\u4e49beanName\u4e3a<span style=\"color: #3da742;\"><strong>applicationEventMulticaster<\/strong><\/span><span style=\"letter-spacing: 0.034em;\">\u7684Bean\u5bf9\u8c61\u5b9e\u73b0\u81ea\u5b9a\u4e49\u3002<\/span><\/span><\/p>\n<p><span style=\"font-size: 16px;\"><strong><span style=\"letter-spacing: 0.034em; box-sizing: border-box; transform-style: preserve-3d; text-indent: 0em; transform: translate3d(0px, 0px, 1px); font-weight: bold; display: inline-table;\"><span style=\"font-size: 16px; color: rgba(0, 0, 0, 0.9); transform: translate3d(0px, 0px, 1px); display: inline-block; font-weight: bold;\"><span style=\"display: inline-table; box-sizing: border-box; transform-style: preserve-3d; text-indent: 0em;\" data-mpa-emphasize-underline=\"t\"><span style=\"font-size: 16px; color: rgba(0, 0, 0, 0.9); transform: translate3d(0px, 0px, 1px); display: inline-block; font-weight: bold;\">7. \u4f18\u96c5\u5173\u95ed\u670d\u52a1<\/span><\/span><\/span><\/span><\/strong><\/span><\/p>\n<p><span style=\"font-size: 15px; letter-spacing: 0.034em;\">\u5982\u679c\u4f60\u662f\u5185\u5d4cTomcat\u542f\u52a8\uff08\u4ee5Jar\u5305\u5f62\u5f0f\uff09SpringBoot\u9879\u76ee\uff0c\u90a3\u4e48\u4f1a\u5411\u5bb9\u5668\u4e2d\u6ce8\u518c\u4e00\u4e2a<\/span><span style=\"letter-spacing: 0.034em; font-size: 15px; color: #ff0000;\"><strong><span style=\"background-color: #ffffff; padding-left: 2px; letter-spacing: 0.034em; font-family: Consolas; font-size: 12pt; white-space-collapse: preserve;\">WebServerGracefulShutdownLifecycle<\/span><\/strong><\/span><span style=\"font-size: 15px; letter-spacing: 0.034em;\">\u5bf9\u8c61\uff0c\u901a\u8fc7\u8be5\u5bf9\u8c61\u4f60\u53ef\u4ee5\u4f18\u96c5\u7684\u5173\u95ed\u670d\u52a1\u3002<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"css\"><code><span class=\"code-snippet_outer\">@Resource<\/span><\/code><code><span class=\"code-snippet_outer\">privateWebServerGracefulShutdownLifecyclewebServerGracefullShutdown;<\/span><\/code><code><span class=\"code-snippet_outer\">public void shutdownWebServer() {<\/span><\/code><code><span class=\"code-snippet_outer\">  webServerGracefullShutdown.stop(() -&gt; {<\/span><\/code><code><span class=\"code-snippet_outer\">    System.out.println(\"\u4f18\u96c5\u5173\u95edWeb Server\");<\/span><\/code><code><span class=\"code-snippet_outer\">    context.close() ;<\/span><\/code><code><span class=\"code-snippet_outer\">  }) ;<\/span><\/code><code><span class=\"code-snippet_outer\">}<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px;\">\u6ce8\u610f\uff1a\u4f60\u8fd8\u9700\u8981\u5f00\u542f\u5982\u4e0b\u914d\u7f6e<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"properties\"><code><span class=\"code-snippet_outer\">server:<\/span><\/code><code><span class=\"code-snippet_outer\">  shutdown: graceful<\/span><\/code><\/pre>\n<\/section>\n<p><span style=\"font-size: 15px; letter-spacing: 0.034em;\">\u5f53\u6267\u884c\u4e0a\u9762\u52a8\u4f5c\uff0c\u8f93\u51fa\u5982\u4e0b<\/span><\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221009219.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-galleryid=\"\" data-imgfileid=\"300130828\" data-ratio=\"0.10555555555555556\" data-s=\"300,640\" data-type=\"png\" data-w=\"1080\" \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221009219.png\" data-galleryid=\"\" data-imgfileid=\"300130828\" data-ratio=\"0.10555555555555556\" data-s=\"300,640\" data-type=\"png\" data-w=\"1080\" \/><\/noscript><\/p>\n<p><span style=\"font-size: 15px;\">\u5f53\u7136\uff0c\u4f60\u4e5f\u53ef\u4ee5\u901a\u8fc7actuator\u6765\u8fdb\u884c\u4f18\u96c5\u7684\u5173\u95edwebserver\u3002<\/span><\/p>\n<p><span style=\"color: #ac39ff;\"><strong><span style=\"letter-spacing: 0.034em; font-size: 16px;\">\u4ee5\u4e0a\u662f\u672c\u7bc7\u6587\u7ae0\u7684\u5168\u90e8\u5185\u5bb9\uff0c\u5982\u5bf9\u4f60\u6709\u5e2e\u52a9\u5c31\u8bf7\u4f5c\u8005\u5403\u4e2a\u68d2\u68d2\u7cd6\ud83c\udf6d\u3002<\/span><\/strong><\/span><\/p>\n<p><span style=\"color: #ac39ff;\"><strong><span style=\"letter-spacing: 0.034em; font-size: 16px;\">\u63a8\u8350\u6587\u7ae0<\/span><\/strong><\/span><\/p>\n<p><span style=\"font-size: 15px; letter-spacing: 0.034em;\"><a href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA5MzI5NjQxNQ==&amp;mid=2447614464&amp;idx=1&amp;sn=71f3e1d51fb97c6ff11be25917cef11d&amp;chksm=84770070b3008966cadb6355deb06757339c84059e632305adc4468ea908159476552edf5479&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >\u8fd9\u624d\u662fSpring\u4e3a\u4ec0\u4e48\u4e0d\u652f\u6301static\u5b57\u6bb5\u6ce8\u5165\u7684\u539f\u56e0\u3010\u6e90\u7801\u5206\u6790\u3011<\/a><\/span><\/p>\n<p><a style=\"font-size: 15px; color: #ff0000;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA5MzI5NjQxNQ==&amp;mid=2447614689&amp;idx=1&amp;sn=a025c820ec6d534187cf32b756a51d63&amp;chksm=84770091b30089872a64e7e5aef7d1e484ba436dc8da23c333f63d530c01b2d7a399055a2342&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"color: #ff0000;\"><strong><span style=\"color: #ff0000; font-size: 15px;\">\u77a7\u77a7\u8001\u5916\u603b\u7ed3\u7684SpringBoot\u6700\u4f73\u5b9e\u8df5<\/span><\/strong><\/span><\/a><\/p>\n<p><a style=\"font-size: 15px;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA5MzI5NjQxNQ==&amp;mid=2447614626&amp;idx=1&amp;sn=1130765e2f5cb665daff4f67fdd09e9b&amp;chksm=847700d2b30089c45f455e351f3a732f4e4f192fb1ff27544bc0f9bd378c82e0b673d530acc5&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"font-size: 15px;\">\u8bf7\u4e00\u5b9a\u638c\u63e1SpringBoot\u8fd94\u4e2a\u9ad8\u7ea7\u5f00\u53d1\u6280\u5de7<\/span><\/a><\/p>\n<p><a style=\"font-size: 15px; color: #ff0000;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA5MzI5NjQxNQ==&amp;mid=2447614619&amp;idx=1&amp;sn=aadbf43bf35603c2f9bc981886ac241c&amp;chksm=847700ebb30089fd5a258d1b07e81ecc74b5a81bb923c67f32ee5cec164b0b8a9664dd21a740&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"color: #ff0000;\"><strong><span style=\"color: #ff0000; font-size: 15px;\">SpringBoot\u4e2dController\u63a5\u53e3\u53c2\u6570\u8fd8\u53ef\u4ee5\u8fd9\u6837\u73a9\uff1f<\/span><\/strong><\/span><\/a><\/p>\n<p><a style=\"font-size: 15px;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA5MzI5NjQxNQ==&amp;mid=2447614611&amp;idx=1&amp;sn=be53c36b1632a7e44d140212fcc468d8&amp;chksm=847700e3b30089f525bd7cc19cf191ab4fdae1c2ff6e04e5fe41f918c27c5f4a3f11b2b98b04&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"font-size: 15px;\">\u8b66\u60d5\uff01SpringBoot\u9519\u8bef\u53d1\u5e03\u4e8b\u4ef6\uff0c\u9020\u6210\u6b7b\u9501Deadlock<\/span><\/a><\/p>\n<p><a style=\"font-size: 15px;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA5MzI5NjQxNQ==&amp;mid=2447614454&amp;idx=1&amp;sn=3fde4748e0df39eb98f06e9da900019e&amp;chksm=84770386b3008a90871e290a191cbaf8a866f04d785ed49b90c56ad867d53aab8ad3b05658de&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"font-size: 15px; color: #ff0000;\"><strong>Spring Boot 3\u592a\u5f3a\uff1a\u5168\u65b0Controller\u63a5\u53e3\u5b9a\u4e49\u65b9\u5f0f<\/strong><\/span><\/a><\/p>\n<p><a style=\"font-size: 15px;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA5MzI5NjQxNQ==&amp;mid=2447614411&amp;idx=1&amp;sn=7d52041725beea34677bd6fea0da214a&amp;chksm=847703bbb3008aad65f35db96928b6c668cc689ce8588efdd5122516a710423cc8fbe4d2e855&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"font-size: 15px;\">SpringBoot\u901a\u8fc7\u7f16\u7a0b\u5f0f\u4e8b\u52a1\u63d0\u9ad8\u7cfb\u7edf\u6027\u80fd<\/span><\/a><\/p>\n<p><a style=\"font-size: 15px;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA5MzI5NjQxNQ==&amp;mid=2447613368&amp;idx=1&amp;sn=7aac0a61c2094bbe54ba97db4e904aa4&amp;chksm=84773fc8b300b6dee9b14e99cb91332c1f72f0e834bec80c01afdd878e39979d82aacda6bbd6&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"font-size: 15px;\">SpringBoot\u6574\u5408Flink CDC\uff0c\u5b9e\u65f6\u8ffd\u8e2a\u6570\u636e\u53d8\u52a8\uff0c\u65e0\u7f1d\u540c\u6b65\u81f3Redis<\/span><\/a><\/p>\n<p><a style=\"font-size: 15px;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA5MzI5NjQxNQ==&amp;mid=2447613403&amp;idx=1&amp;sn=f0bb487a44276e7c3f89689f1878f0d4&amp;chksm=84773fabb300b6bd64ced1777bbb31f8e077e27defbf5534c6db3e8d4d4b4294d18564a0997a&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"font-size: 15px;\">\u89e3\u9501Spring\u8d44\u6e90Resource\u7684\u5f3a\u5927\u529f\u80fd\uff0c\u63d0\u5347\u5f00\u53d1\u6548\u7387<\/span><\/a><\/p>\n<p><a style=\"font-size: 15px;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA5MzI5NjQxNQ==&amp;mid=2447613295&amp;idx=1&amp;sn=75b8c90f03fcf34bfbeb1ec97556da99&amp;chksm=84773f1fb300b609766f2356ea3afd61a89b11b3e2e25756c05d82c030bc3246cbdee9e94ac2&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"font-size: 15px; color: #ff0000;\"><strong>\u5b9e\u6218Spring Cloud Gateway\u81ea\u5b9a\u4e49\u8c13\u8bcd\u53ca\u7f51\u5173\u8fc7\u6ee4\u5668<\/strong><\/span><\/a><\/p>\n<p><a style=\"font-size: 15px; color: #ff0000;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA5MzI5NjQxNQ==&amp;mid=2447614406&amp;idx=1&amp;sn=c1e555e96b703c30eb1bfa1d1a490351&amp;chksm=847703b6b3008aa07e6b4a569536a65ac626db811b7b2691c3f9add3517dfc2b31e81cc9c28e&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"color: #ff0000;\"><strong><span style=\"color: #ff0000; font-size: 15px;\">\u5f3a\u70c8\u5efa\u8baeJDK\u5347\u7ea7\u523017\uff0c\u56e0\u4e3a\u8fd9\u4e9b\u529f\u80fd<\/span><\/strong><\/span><\/a><\/p>\n<p><a style=\"font-size: 15px;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA5MzI5NjQxNQ==&amp;mid=2447612028&amp;idx=1&amp;sn=b1b7f7b181beb2828ccb77d00fb8eb83&amp;chksm=84773a0cb300b31ae50545f4f9c61261c25483649a65c7eae9042a7eda7543d84f16b6aeafa3&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"font-size: 15px;\">\u89e3\u9501Spring\u9690\u85cf\u5de5\u5177\u7c7b\uff1a\u8ba9\u4f60\u7684\u5f00\u53d1\u6548\u7387\u98de\u5347<\/span><\/a><\/p>\n<p><a style=\"font-size: 15px;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA5MzI5NjQxNQ==&amp;mid=2447612010&amp;idx=1&amp;sn=3e06275782d77e51f15409635338b247&amp;chksm=84773a1ab300b30cbed5df5aa4802264edb240d5529add66c10a096514f9aaa481d2d5cd667c&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"font-size: 15px;\">\u8be6\u89e3Spring Cloud Task\u77ed\u671f\u8fd0\u884c\u7684\u5fae\u670d\u52a1\u6846\u67b6<\/span><\/a><\/p>\n<p><a style=\"font-size: 15px; color: #ff0000;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA5MzI5NjQxNQ==&amp;mid=2447611816&amp;idx=1&amp;sn=0c7c8f96a8cfb002a5c6f9a45dadc9e5&amp;chksm=847735d8b300bcceb84491d1722cb8930ab2ca59b9552ad9164aaf2d99f5c21e21361c3b00e5&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"color: #ff0000;\"><strong><span style=\"color: #ff0000; font-size: 15px;\">\u57fa\u4e8e\u54cd\u5e94\u5f0fWebSocket\u5373\u65f6\u901a\u4fe1<\/span><\/strong><\/span><\/a><\/p>\n<p><a style=\"font-size: 15px;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzA5MzI5NjQxNQ==&amp;mid=2447611772&amp;idx=1&amp;sn=c76bd7c8567c126757a59711cb0bc324&amp;chksm=8477350cb300bc1a841df3853807f478f6cd620331e925147834e3d9cb8089dad08a4c8388b3&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"font-size: 15px;\">\u3010\u5206\u4eab\u3011SpringBoot\u8fd9\u51e0\u4e2a\u5c0f\u6280\u5de7\u8fd8\u662f\u633a\u5b9e\u7528\u7684<\/span><\/a><\/p>\n<p><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221025350.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-imgfileid=\"300125271\" data-ratio=\"0.4935185185185185\" data-s=\"300,640\" data-type=\"png\" data-w=\"1080\" \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221025350.png\" data-imgfileid=\"300125271\" data-ratio=\"0.4935185185185185\" data-s=\"300,640\" data-type=\"png\" data-w=\"1080\" \/><\/noscript><\/p>\n<p><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221032733.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-imgfileid=\"300123045\" data-ratio=\"1.9711286089238844\" data-s=\"300,640\" data-type=\"png\" data-w=\"381\" \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221032733.png\" data-imgfileid=\"300123045\" data-ratio=\"1.9711286089238844\" data-s=\"300,640\" data-type=\"png\" data-w=\"381\" \/><\/noscript><\/p>\n<p style=\"display: none;\">\n<blockquote><p>\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e\u5fae\u4fe1\u516c\u4f17\u53f7: Spring\u5168\u5bb6\u6876\u5b9e\u6218\u6848\u4f8b\u6e90\u7801<\/p><\/blockquote>\n<\/div>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>\u73af\u5883\uff1aSpringBoot2.7.18 1. \u5e94\u7528\u7a0b\u5e8f\u53c2\u6570 SpringBoot\u7a0b\u5e8f\u5728\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u65b9\u5f0f\u8bbe\u7f6e\u542f\u52a8\u53c2\u6570\uff1a ja &#8230;<\/p>\n","protected":false},"author":1,"featured_media":5366,"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-5378","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring-boot"],"post_thumbnail_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221005541-150x150.jpeg","content_first_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221009219.png","post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221005541-300x127.jpeg","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221005541.jpeg","post_frist_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221009219.png","post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221005541-300x127.jpeg","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221005541.jpeg","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221005541.jpeg","post_all_images":[{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221009219.png","id":"image0"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221009219.png","id":"image1"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221025350.png","id":"image2"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221025350.png","id":"image3"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221032733.png","id":"image4"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801221032733.png","id":"image5"}],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"Spring Boot","post_date":"2024-08-01","like_count":"0","praiseWord":"\u9f13\u52b1","copyright_state":"","excitationAd":"0","rewardedVideoAdId":"","detailAdId":"","detailAd":"0","enterpriseMinapp":"0","audios":[],"postImageUrl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230519082947553.jpg","avatarurls":[],"related_posts":null,"pageviews":306,"next_post_id":5740,"next_post_title":"\u638c\u63e1Spring MVC\u4e2d\u81ea\u5b9a\u4e49\u6ce8\u89e3\u7684\u5999\u7528\uff0c\u4e3a\u4f60\u7684\u4ee3\u7801\u589e\u6dfb\u6574\u6d01\u4e0e\u4f18\u96c5\u3002","previous_post_id":5541,"previous_post_title":"\u67b6\u6784\u5e08\u5fc5\u77e5\u768411\u79cdAPI\u6027\u80fd\u4f18\u5316\u65b9\u6cd5","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/5378","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=5378"}],"version-history":[{"count":2,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/5378\/revisions"}],"predecessor-version":[{"id":6441,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/5378\/revisions\/6441"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media\/5366"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=5378"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=5378"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=5378"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}