{"id":735,"date":"2023-05-28T02:11:04","date_gmt":"2023-05-27T18:11:04","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=735"},"modified":"2023-05-28T02:11:04","modified_gmt":"2023-05-27T18:11:04","slug":"spring-bean%e7%9a%84%e4%bd%9c%e7%94%a8%e5%9f%9f%e7%9b%b8%e5%85%b3%e7%9f%a5%e8%af%86%e7%82%b9","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/spring-boot\/spring-bean%e7%9a%84%e4%bd%9c%e7%94%a8%e5%9f%9f%e7%9b%b8%e5%85%b3%e7%9f%a5%e8%af%86%e7%82%b9\/","title":{"rendered":"Spring Bean\u7684\u4f5c\u7528\u57df\u76f8\u5173\u77e5\u8bc6\u70b9"},"content":{"rendered":"<div class='wxsyncmain'>\n<section><mp-common-profile class=\"js_uneditable custom_select_card mp_profile_iframe\" data-pluginname=\"mpprofile\" data-weui-theme=\"light\" data-id=\"MzI3ODE5MzczNA==\" data-headimg=\"http:\/\/mmbiz.qpic.cn\/mmbiz_png\/OC2PjnBlMZjic6L6UHJXiaT0JCXiapkjUlh1wc5YRxBr1FvF4JB2kMibDia0m1vPHLtKr1BMxWm2QeGBRJhiaicbicw00w\/0?wx_fmt=png\" data-nickname=\"\u5218\u724c\" data-alias=\"\" data-signature=\"\u5bfb\u5e38\u7684\u74e6\u820d\u8bc4\u4e66\uff0c\u6697\u85cf\u7740\u6551\u4e16\u79d8\u8bc0\u3002\" data-from=\"0\" data-is_biz_ban=\"0\"><\/mp-common-profile><\/section>\n<section data-tool=\"mdnice\u7f16\u8f91\u5668\" data-website=\"https:\/\/www.mdnice.com\" style=\"color: black;line-height: 1.6;letter-spacing: 0px;word-break: break-word;overflow-wrap: break-word;text-align: left;font-size: 16px;padding: 10px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;\">\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin-top: 15px;\"><span style=\"display: none;\"><\/span><span style=\"font-size: 18px;color: #f48a00;display: inline-block;padding-left: 10px;border-left: 4px solid #ffe3a3;\">\u524d\u8a00<\/span><span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">\u4eca\u5929\u5206\u4eab\u4e00\u4e0bspring bean\u7684\u4f5c\u7528\u57df\uff0c\u7406\u89e3bean\u7684\u4f5c\u7528\u57df\u80fd\u591f\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u907f\u514d\u4e00\u4e9b\u95ee\u9898\uff0cbean\u7684\u4f5c\u7528\u57df\u4e5f\u662fspring bean\u521b\u5efa\u8fc7\u7a0b\u4e2d\u4e00\u4e2a\u91cd\u8981\u7684\u70b9\u3002<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin-top: 15px;\"><span style=\"display: none;\"><\/span><span style=\"font-size: 18px;color: #f48a00;display: inline-block;padding-left: 10px;border-left: 4px solid #ffe3a3;\">Spring bean\u7684\u4f5c\u7528\u57df\u7c7b\u578b<\/span><span style=\"display: none;\"><\/span><\/h3>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-size: 15px;margin-top: 8px;margin-bottom: 8px;padding-left: 20px;color: rgb(255, 191, 82);\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;letter-spacing: 0.1em;word-spacing: 0.1em;color: rgba(0, 0, 0, 0.55);\">\n<p style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;font-size: 16px;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">singleton\uff08\u5355\u4f8b\u6a21\u5f0f\uff09\uff1a\u5728\u6574\u4e2a\u5e94\u7528\u7a0b\u5e8f\u7684\u751f\u547d\u5468\u671f\u4e2d\uff0c\u53ea\u521b\u5efa\u4e00\u4e2aBean\u5b9e\u4f8b\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6240\u6709\u7684Bean\u90fd\u662f\u5355\u4f8b\u6a21\u5f0f\u3002<\/p>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;letter-spacing: 0.1em;word-spacing: 0.1em;color: rgba(0, 0, 0, 0.55);\">\n<p style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;font-size: 16px;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">prototype\uff08\u539f\u578b\u6a21\u5f0f\uff09\uff1a\u6bcf\u6b21\u8bf7\u6c42Bean\u65f6\u90fd\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5b9e\u4f8b\u3002<\/p>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;letter-spacing: 0.1em;word-spacing: 0.1em;color: rgba(0, 0, 0, 0.55);\">\n<p style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;font-size: 16px;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">request\uff08\u8bf7\u6c42\u6a21\u5f0f\uff09\uff1a\u6bcf\u6b21HTTP\u8bf7\u6c42\u90fd\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5b9e\u4f8b\uff0c\u8be5\u4f5c\u7528\u57df\u4ec5\u9002\u7528\u4e8eWeb\u5e94\u7528\u7a0b\u5e8f\u7684Spring MVC\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;letter-spacing: 0.1em;word-spacing: 0.1em;color: rgba(0, 0, 0, 0.55);\">\n<p style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;font-size: 16px;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">session\uff08\u4f1a\u8bdd\u6a21\u5f0f\uff09\uff1a\u6bcf\u4e2a\u7528\u6237\u4f1a\u8bdd\u90fd\u6709\u4e00\u4e2aBean\u5b9e\u4f8b\uff0c\u8be5\u4f5c\u7528\u57df\u4ec5\u9002\u7528\u4e8eWeb\u5e94\u7528\u7a0b\u5e8f\u7684Spring MVC\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;letter-spacing: 0.1em;word-spacing: 0.1em;color: rgba(0, 0, 0, 0.55);\">\n<p style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;font-size: 16px;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">globalSession\uff08\u5168\u5c40\u4f1a\u8bdd\u6a21\u5f0f\uff09\uff1a\u7528\u4e8ePortlet\u5e94\u7528\u7a0b\u5e8f\uff0c\u4e00\u4e2a\u5168\u5c40\u4f1a\u8bdd\u6709\u4e00\u4e2aBean\u5b9e\u4f8b\u3002<\/p>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;letter-spacing: 0.1em;word-spacing: 0.1em;color: rgba(0, 0, 0, 0.55);\">\n<p style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;font-size: 16px;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">application\uff08\u5e94\u7528\u7a0b\u5e8f\u6a21\u5f0f\uff09\uff1a\u5728Web\u5e94\u7528\u7a0b\u5e8f\u4e0a\u4e0b\u6587\u4e2d\uff0c\u53ea\u521b\u5efa\u4e00\u4e2aBean\u5b9e\u4f8b\u3002<\/p>\n<\/section>\n<\/li>\n<\/ul>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">\u4ece\u4e0a\u9762\u6211\u4eec\u80fd\u770b\u51faspring\u6709\u5f88\u591a\u79cd\u4f5c\u7528\u57df\uff0c\u4e0d\u8fc7\u5728\u5b9e\u9645\u4f7f\u7528\u4e2d\uff0c\u6211\u4eec\u57fa\u672c\u90fd\u4f7f\u7528\u5355\u4f8bbean\uff0c\u8fd9\u4e5f\u662fspring bean\u7684\u9ed8\u8ba4\u4f5c\u7528\u57df\uff0c\u5355\u4f8bbean\u80fd\u63d0\u9ad8\u6027\u80fd\uff0c\u56e0\u4e3a\u5168\u5c40\u53ea\u5b58\u5728\u4e00\u4e2abean\u5b9e\u4f8b\uff0c\u800c\u591a\u4f8bbean\u5219\u6bcf\u6b21\u8bf7\u6c42\u90fd\u9700\u8981\u521b\u5efabean\u5b9e\u4f8b\uff0c\u5f53\u5e76\u53d1\u6bd4\u8f83\u5927\u7684\u65f6\u5019\uff0c\u5c31\u4f1a\u6bd4\u8f83\u5f71\u54cd\u6027\u80fd\uff0c\u6240\u4ee5\u8fd9\u65f6\u5019\u5c31\u9700\u8981\u4f7f\u7528\u5355\u4f8bbean\uff0c\u4f46\u662f\u5355\u4f8bbean\u53ef\u80fd\u4f1a\u5b58\u5728\u7ebf\u7a0b\u5b89\u5168\u95ee\u9898\uff0c\u5f53bean\u4e2d\u5b58\u5728\u53ef\u53d8\u7684\u6210\u5458\u53d8\u91cf\u65f6\uff0c\u5c31\u4f1a\u5b58\u5728\u7ebf\u7a0b\u5b89\u5168\u95ee\u9898\uff0c\u800c\u591a\u4f8bbean\u56e0\u4e3a\u6bcf\u6b21\u90fd\u4f1a\u521b\u5efa\u4e00\u4e2a\u5b9e\u4f8b\uff0c\u6240\u4ee5\u4e0d\u5b58\u5728bean\u5171\u4eab\uff0c\u5c31\u4e0d\u5b58\u5728\u7ebf\u7a0b\u5b89\u5168\u95ee\u9898\u3002<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin-top: 15px;\"><span style=\"display: none;\"><\/span><span style=\"font-size: 18px;color: #f48a00;display: inline-block;padding-left: 10px;border-left: 4px solid #ffe3a3;\">\u4f7f\u7528\u4f5c\u7528\u57df<\/span><span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">\u73b0\u5728\u6211\u4eec\u57fa\u672c\u90fd\u662f\u4f7f\u7528SpringBoot\uff0c\u90fd\u662f\u57fa\u4e8e\u6ce8\u89e3\u5f00\u53d1\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u6ce8\u89e3@Scope\u8bbe\u7f6ebean\u7684\u4f5c\u7528\u57df\uff0c\u53ef\u4ee5\u6807\u6ce8\u5728\u7c7b\u4e0a\u548c\u65b9\u6cd5\u4e0a\u3002<\/p>\n<h4 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 18px;margin-top: 10px;\"><span style=\"display: none;\"><\/span><span style=\"font-size: 16px;color: #f48a00;display: inline-block;\">\u6807\u6ce8\u65b9\u6cd5<\/span><span style=\"display: none;\"><\/span><\/h4>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">\u5f53\u6211\u4eec\u4f7f\u7528@Bean\u5b9a\u4e49Bean\u7684\u65f6\u5019\uff0c\u8bbe\u7f6e\u4f5c\u7528\u57df\u53ef\u4ee5\u76f4\u63a5\u5728\u65b9\u6cd5\u4e0a\u9762\u4f7f\u7528@Scope\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:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528015726403.jpeg&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;\">@Component<\/span><br  \/><span style=\"color: #61aeee;line-height: 26px;\">@Scope<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"prototype\"<\/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;\">ScopeBean<\/span>&nbsp;<\/span>{<br  \/><br  \/>}<br  \/><\/code><\/pre>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin-top: 15px;\"><span style=\"display: none;\"><\/span><span style=\"font-size: 18px;color: #f48a00;display: inline-block;padding-left: 10px;border-left: 4px solid #ffe3a3;\">\u83b7\u53d6bean\u548c\u521b\u5efabean<\/span><span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">\u5982\u679c\u662f\u5355\u4f8bbean\uff0c\u5728spring\u5bb9\u5668\u542f\u52a8\u7684\u65f6\u5019\u4f1a\u5c06Bean\u6ce8\u518c\u8fdbIOC\u5bb9\u5668\u4e2d\uff0c\u5982\u679c\u662f\u591a\u4f8bbean\uff0c\u5219\u4e0d\u6ce8\u518c\u8fdbIOC\u5bb9\u5668\u4e2d\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">bean\u5728\u5b9e\u4f8b\u5316\u524d\u4f1a\u628abean\u7684\u57fa\u7840\u4fe1\u606f\u7ec4\u88c5\u6210BeanDefinition\uff0c\u7136\u540e\u4fdd\u5b58\u5230BeanFactory\u4e2d\uff0c\u5982\u679c\u662f\u5355\u4f8b\u7684bean\uff0c\u5219\u4f1a\u7ee7\u7eed\u5bf9bean\u5904\u7406\u540e\u5c06bean\u6ce8\u518c\u5230IOC\u5bb9\u5668\u4e2d\uff0c\u5982\u679c\u662f\u591a\u4f8bbean\uff0c\u5219\u4e0d\u6ce8\u518c\u8fdb\uff0c\u5f53\u4eceIOC\u5bb9\u5668\u4e2d\u83b7\u53d6bean\u65f6\uff0c\u5982\u679c\u662f\u5355\u4f8b\u5219\u4eceIOC\u5bb9\u5668\u4e2d\u83b7\u53d6\u5df2\u7ecf\u521b\u5efa\u597d\u7684bean\uff0c\u5982\u679c\u662f\u591a\u4f8b\uff0c\u5219\u4eceBeanFactory\u4e2d\u83b7\u53d6bean\u7684\u5b9a\u4e49\u4fe1\u606fBeanDefinition\uff0c\u7136\u540e\u91cd\u590d\u548c\u5355\u4f8bbean\u4e00\u6837\u7684\u6b65\u9aa4\u521b\u5efabean\uff0c\u53ea\u662f\u521b\u5efa\u540e\u5b83\u4e0d\u4f1a\u4fdd\u5b58\u8fdbIOC\u5bb9\u5668\uff0c\u800c\u662f\u76f4\u63a5\u8fd4\u56de\u3002<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin-top: 15px;\"><span style=\"display: none;\"><\/span><span style=\"font-size: 18px;color: #f48a00;display: inline-block;padding-left: 10px;border-left: 4px solid #ffe3a3;\">\u4f5c\u7528\u57df\u548c\u61d2\u52a0\u8f7d<\/span><span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">\u5982\u679cbean\u8bbe\u7f6e\u4e3a\u61d2\u52a0\u8f7d(Lazy)\u548c\u5355\u4f8bbean\uff0c\u90a3\u4e48bean\u5728spring\u542f\u52a8\u65f6\u4e0d\u4f1a\u6ce8\u518c\u8fdb\u5bb9\u5668\u4e2d\uff0c\u800c\u662f\u7b49\u7b2c\u4e00\u6b21\u83b7\u53d6bean\u7684\u65f6\u5019\u5728\u521b\u5efabean\uff0c\u540e\u9762\u83b7\u53d6bean\u7684\u65f6\u5019\u518d\u4eceIOC\u5bb9\u5668\u4e2d\u83b7\u53d6\uff0c\u5982\u679c\u8bbe\u7f6e\u4e3a\u591a\u4f8bbean\uff0c\u90a3\u4e48\u61d2\u52a0\u8f7d\u5176\u5b9e\u662f\u6ca1\u7528\u7684\u3002<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin-top: 15px;\"><span style=\"display: none;\"><\/span><span style=\"font-size: 18px;color: #f48a00;display: inline-block;padding-left: 10px;border-left: 4px solid #ffe3a3;\">\u6e90\u7801\u89e3\u6790<\/span><span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">\u6e90\u7801\u6bd4\u8f83\u7b80\u5355\uff0c\u5176\u5b9e\u5c31\u662f\u5224\u65adbean\u7684\u7c7b\u578b\uff0c\u7136\u540e\u518d\u8fdb\u5165\u4e0d\u540c\u7684\u903b\u8f91\u8fdb\u884c\u5904\u7406\uff0c\u5728AbstractBeanFactory\u4e2d\uff0c\u901a\u8fc7doGetBean()\u65b9\u6cd5\u83b7\u53d6bean\u3002<\/p>\n<h4 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 18px;margin-top: 10px;\"><span style=\"display: none;\"><\/span><span style=\"font-size: 16px;color: #f48a00;display: inline-block;\">\u5224\u65adbean\u662f\u5426\u5b58\u5728\u5bb9\u5668\u4e2d<\/span><span style=\"display: none;\"><\/span><\/h4>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">\u4e0b\u56fe\u901a\u8fc7getSingleton()\u65b9\u6cd5\u4ecesingletonObjects\u4e2d\u83b7\u53d6bean\uff0c\u5982\u679c\u83b7\u53d6\u5230\u76f4\u63a5\u8fd4\u56de\uff0c\u4ee3\u8868bean\u5df2\u7ecf\u521b\u5efa\u8fc7\u52d2\uff0c\u5df2\u7ecf\u5b58\u5728\u4e0eIOC\u5bb9\u5668\u4e2d\uff0csingletonObjects\u5c31\u662f\u6574\u4e2aspring\u4e2d\u88c5bean\u5b9e\u4f8b\u7684\u5bb9\u5668\uff0c\u4ed6\u5c31\u662f\u4e00\u4e2aMap\uff0cspring\u6574\u4e2abean\u7684\u521b\u5efa\u8fc7\u7a0b\u76ee\u7684\u5c31\u662f\u628abean\u653e\u8fdb\u5b83\u91cc\u9762\uff0c<code style=\"font-size: 14px;overflow-wrap: break-word;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(244, 138, 0);\">\u6240\u4ee5spring\u7b80\u5355\u5f97\u4e0d\u884c\uff0c\u4f46\u662f\u66f4\u590d\u6742\u5f97\u4e0d\u884c<\/code>\u3002<\/p>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.5351418002466092\"  data-type=\"png\" data-w=\"811\" style=\"border-radius: 5px;display: block;margin-right: 10px;margin-bottom: auto;margin-left: 10px;width: 100%;height: 100%;object-fit: contain;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528015721528.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.5351418002466092\"  data-type=\"png\" data-w=\"811\" style=\"border-radius: 5px;display: block;margin-right: 10px;margin-bottom: auto;margin-left: 10px;width: 100%;height: 100%;object-fit: contain;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528015721528.png\"  \/><\/noscript><\/figure>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin-top: 15px;\"><span style=\"display: none;\"><\/span><span style=\"font-size: 18px;color: #f48a00;display: inline-block;padding-left: 10px;border-left: 4px solid #ffe3a3;\">bean\u4e0d\u5b58\u5728\uff0c\u5219\u521b\u5efa<\/span><span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">\u4e0b\u56fe\u6709\u4e24\u4e2a\u5224\u65ad\uff0c\u5224\u65ad\u5355\u4f8bbean\u548c\u591a\u4f8bbean\uff0c\u5355\u4f8bbean\u4f1a\u521b\u5efabean\u540e\u7136\u540e\u52a0\u5165\u5230singletonObjects\u4e2d\uff0c\u591a\u4f8bbean\u5219\u76f4\u63a5\u8fd4\u56de\uff0c\u4ed6\u4eec\u7684\u521b\u5efa\u90fd\u662f\u8d70\u540c\u4e00\u4e2a\u65b9\u6cd5\uff0c\u540c\u4e00\u6837\u7684\u6d41\u7a0b\u3002<img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.6158129175946548\"  data-type=\"png\" data-w=\"898\" style=\"border-radius: 5px;display: block;margin-right: 10px;margin-bottom: auto;margin-left: 10px;width: 100%;height: 100%;object-fit: contain;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528015723837.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.6158129175946548\"  data-type=\"png\" data-w=\"898\" style=\"border-radius: 5px;display: block;margin-right: 10px;margin-bottom: auto;margin-left: 10px;width: 100%;height: 100%;object-fit: contain;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528015723837.png\"  \/><\/noscript><\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">\u5177\u4f53\u7684\u521b\u5efa\u6d41\u7a0b\u5c31\u4e0d\u4e00\u4e00\u7ec6\u8bf4\uff0c\u53ea\u662f\u4ece\u5927\u4f53\u601d\u8def\u53bb\u8bb2\u89e3\uff0c\u56e0\u4e3a\u5f80\u91cc\u9762\u8bf4\u5c31\u8d34\u51fa\u5927\u7bc7\u4ee3\u7801\uff0c\u6ca1\u5565\u5fc5\u8981\uff0c\u611f\u5174\u8da3\u53ef\u4ee5\u53bb\u770b\u6e90\u7801\u3002<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin-top: 15px;\"><span style=\"display: none;\"><\/span><span style=\"font-size: 18px;color: #f48a00;display: inline-block;padding-left: 10px;border-left: 4px solid #ffe3a3;\">\u603b\u7ed3<\/span><span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;margin-top: 5px;margin-bottom: 5px;line-height: 1.75;letter-spacing: 0.1em;word-spacing: 0.1em;text-align: justify;color: rgba(0, 0, 0, 0.85);\">\u4e0a\u9762\u8bf4\u4e86bean\u7684\u4f5c\u7528\u57df\u7c7b\u578b\uff0c\u5e76\u5bf9\u6bcf\u79cd\u4f5c\u7528\u57df\u7c7b\u578b\u8fdb\u884c\u5206\u6790\uff0c\u6700\u5e38\u7528\u7684\u5176\u5b9e\u5c31\u662f\u5355\u4f8b\uff0c\u5e76\u5bf9\u591a\u4f8b\u548c\u5355\u4f8b\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u7684\u4e00\u4e9b\u6ce8\u610f\u4e8b\u9879\u8fdb\u884c\u8bb2\u89e3\uff0c\u63a5\u7740\u8bf4\u4e86\u600e\u4e48\u4f7f\u7528\u4f5c\u7528\u57df\uff0c\u8fd8\u6709\u61d2\u52a0\u8f7d\u548c\u4f5c\u7528\u57df\u7684\u5173\u8054\uff0c\u5e76\u5bf9bean\u7684\u521b\u5efa\u548c\u83b7\u53d6\u4ece\u6e90\u7801\u548c\u767d\u8bdd\u8fdb\u884c\u5927\u4f53\u7684\u5206\u6790\u3002<\/p>\n<blockquote data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-size: 0.9em;overflow: auto;color: rgb(106, 115, 125);padding: 10px 10px 10px 20px;margin-bottom: 20px;margin-top: 20px;text-size-adjust: 100%;line-height: 1.75em;border-radius: 5px;box-sizing: inherit;border-width: 1px;border-top-style: solid;border-right-style: solid;border-bottom-style: solid;border-color: rgb(255, 191, 82);background: rgb(255, 248, 230);\"><p><span style=\"color: #f48a00;font-size: 32px;line-height: 0.6;margin-left: -15px;\">\u275d<\/span><\/p>\n<p style=\"padding-top: 8px;padding-bottom: 8px;letter-spacing: 0.1em;font-size: 16px;word-spacing: 0.1em;text-align: justify;line-height: 26px;margin-top: -15px;color: rgba(0, 0, 0, 0.85);\">\u4eca\u5929\u7684\u5206\u4eab\u5c31\u5230\u8fd9\u91cc\uff0c\u611f\u8c22\u4f60\u7684\u89c2\u770b\uff0c\u6211\u4eec\u4e0b\u671f\u89c1!<\/p>\n<\/blockquote>\n<\/section>\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:                 \u5218\u724c              <\/p>\n<\/blockquote>\n<\/div>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u4eca\u5929\u5206\u4eab\u4e00\u4e0bspring bean\u7684\u4f5c\u7528\u57df\uff0c\u7406\u89e3bean\u7684\u4f5c\u7528\u57df\u80fd\u591f\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u907f\u514d\u4e00\u4e9b\u95ee\u9898\uff0cbean\u7684\u4f5c\u7528\u57df\u4e5f\u662fsprin &#8230;<\/p>\n","protected":false},"author":2,"featured_media":731,"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-735","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\/20230528015720744-150x150.jpeg","content_first_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528015721528.png","post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528015720744-300x128.jpeg","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528015720744-1024x436.jpeg","post_frist_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528015721528.png","post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528015720744-300x128.jpeg","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528015720744-1024x436.jpeg","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528015720744.jpeg","post_all_images":[{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528015721528.png","id":"image0"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528015721528.png","id":"image1"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528015723837.png","id":"image2"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528015723837.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":262,"next_post_id":1005,"next_post_title":"\u6570\u636e\u5e93\u94fe\u63a5\u6c60\u7ec8\u4e8e\u641e\u5bf9\u4e86\uff0c\u8fd9\u6b21\u76f4\u63a5\u4ece100ms\u4f18\u5316\u52303ms\uff01","previous_post_id":917,"previous_post_title":"Spring-15 Spring Certified Professional \u8bd5\u9898\u6574\u7406 \u2460","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/735","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\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=735"}],"version-history":[{"count":0,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/735\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media\/731"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}