{"id":2410,"date":"2023-06-29T10:40:25","date_gmt":"2023-06-29T02:40:25","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=2410"},"modified":"2023-07-04T18:44:45","modified_gmt":"2023-07-04T10:44:45","slug":"spring%e7%9a%84bean%e5%8a%a0%e8%bd%bd%e6%b5%81%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/spring\/spring%e7%9a%84bean%e5%8a%a0%e8%bd%bd%e6%b5%81%e7%a8%8b\/","title":{"rendered":"Spring\u7684Bean\u52a0\u8f7d\u6d41\u7a0b"},"content":{"rendered":"<div class=\"wxsyncmain\">\n<section class=\"mp_profile_iframe_wrp\"><\/section>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left; visibility: visible;\"><span style=\"outline: 0px; visibility: visible;\">Spring <\/span><span style=\"outline: 0px; visibility: visible;\">IOC<\/span><span style=\"outline: 0px; visibility: visible;\">\u5bb9\u5668\u5c31\u50cf\u662f\u4e00\u4e2a\u751f\u4ea7\u4ea7\u54c1\u7684\u6d41\u6c34\u7ebf\u4e0a\u7684\u673a\u5668\uff0cSpring\u521b\u5efa\u51fa\u6765\u7684Bean\u5c31\u597d\u50cf\u662f\u6d41\u6c34\u7ebf\u7684\u7ec8\u70b9\u751f\u4ea7\u51fa\u6765\u7684\u4e00\u4e2a\u4e2a\u7cbe\u7f8e\u7edd\u4f26\u7684\u4ea7\u54c1\u3002\u65e2\u7136\u662f\u673a\u5668\uff0c\u603b\u8981\u5148\u542f\u52a8\uff0cSpring\u4e5f\u4e0d\u4f8b\u5916\u3002\u56e0\u6b64Bean\u7684\u52a0\u8f7d\u6d41\u7a0b\u603b\u4f53\u4e0a\u6765\u8bf4\u53ef\u4ee5\u5206\u4e3a\u4e24\u4e2a\u9636\u6bb5\uff1a<\/span><\/p>\n<ul class=\"list-paddingleft-1\" style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-left: 30px; outline: 0px; text-wrap: wrap; background-color: #ffffff; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: start; visibility: visible;\" data-mark=\"-\">\n<li style=\"outline: 0px; visibility: visible;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; visibility: visible; text-align: left;\"><span style=\"outline: 0px; visibility: visible;\">\u5bb9\u5668\u542f\u52a8\u9636\u6bb5<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px; visibility: visible;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; visibility: visible; text-align: left;\"><span style=\"outline: 0px; visibility: visible;\">Bean\u521b\u5efa\u9636\u6bb5<\/span><\/p>\n<\/li>\n<\/ul>\n<h2 style=\"margin-top: 1rem; margin-bottom: 1rem; outline: 0px; font-weight: bold; font-size: 1.75em; background-color: #ffffff; white-space: pre-wrap; break-after: avoid-page; break-inside: avoid; orphans: 4; line-height: 1.225; cursor: text; border-bottom: 1px solid #eeeeee; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; letter-spacing: normal; text-align: left; visibility: visible;\"><span style=\"outline: 0px; visibility: visible;\">\u4e00\u3001\u5bb9\u5668\u542f\u52a8\u9636\u6bb5\uff1a<\/span><\/h2>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left; visibility: visible;\"><span style=\"outline: 0px; visibility: visible;\">\u5bb9\u5668\u7684\u542f\u52a8\u9636\u6bb5\u505a\u4e86\u5f88\u591a\u7684\u9884\u70ed\u5de5\u4f5c\uff0c\u4e3a\u540e\u9762Bean\u7684\u5b9e\u4f8b\u5316\u505a\u597d\u4e86\u5145\u5206\u7684\u51c6\u5907\uff0c\u6211\u4eec\u9996\u5148\u770b\u4e00\u4e0b\u5bb9\u5668\u7684\u542f\u52a8\u9636\u6bb5\u90fd\u505a\u4e86\u54ea\u4e9b\u9884\u70ed\u5de5\u4f5c\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left; visibility: visible;\"><span style=\"outline: 0px; visibility: visible;\"><strong style=\"outline: 0px; visibility: visible;\">1\u3001\u914d\u7f6e\u5143\u4fe1\u606f\uff1a<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left; visibility: visible;\"><span style=\"outline: 0px; visibility: visible;\">Spring IOC\u5bb9\u5668\u5c06\u5bf9\u8c61\u5b9e\u4f8b\u7684\u521b\u5efa\u4e0e\u5bf9\u8c61\u5b9e\u4f8b\u7684\u4f7f\u7528\u5206\u79bb\uff0c\u5f53\u4e1a\u52a1\u4e2d\u9700\u8981\u4f9d\u8d56\u67d0\u4e2a\u5bf9\u8c61\uff0c\u4e0d\u518d\u4f9d\u9760\u6211\u4eec\u81ea\u5df1\u624b\u52a8\u521b\u5efa\uff0c\u53ea\u9700\u5411Spring\u8981\uff0cSpring\u5c31\u4f1a\u4ee5\u6ce8\u5165\u7684\u65b9\u5f0f\u4ea4\u7ed9\u6211\u4eec\u9700\u8981\u7684\u4f9d\u8d56\u5bf9\u8c61\u3002\u65e2\u7136\u5c06\u5bf9\u8c61\u521b\u5efa\u7684\u4efb\u52a1\u4ea4\u7ed9\u4e86Spring\uff0c\u90a3\u4e48Spring\u5c31\u9700\u8981\u77e5\u9053\u521b\u5efa\u4e00\u4e2a\u5bf9\u8c61\u6240\u9700\u8981\u7684\u4e00\u4e9b\u5fc5\u8981\u7684\u4fe1\u606f\u3002\u800c\u8fd9\u4e9b\u5fc5\u8981\u7684\u4fe1\u606f\u53ef\u4ee5\u662fSpring\u8fc7\u53bb\u652f\u6301\u6700\u5b8c\u5584\u7684xml\u914d\u7f6e\u6587\u4ef6\uff0c\u6216\u8005\u662f\u5176\u4ed6\u5f62\u5f0f\u7684\u4f8b\u5982properties\u7684\u78c1\u76d8\u6587\u4ef6\uff0c\u4e5f\u53ef\u4ee5\u662f\u73b0\u5728\u4e3b\u6d41\u7684\u6ce8\u89e3\uff0c\u751a\u81f3\u662f\u76f4\u63a5\u7684\u4ee3\u7801\u786c\u7f16\u7801\u3002\u603b\u4e4b\uff0c\u8fd9\u4e9b\u521b\u5efa\u5bf9\u8c61\u6240\u9700\u8981\u7684\u5fc5\u8981\u4fe1\u606f\u79f0\u4e3a\u914d\u7f6e\u5143\u4fe1\u606f\u3002<\/span><\/p>\n<pre lang=\"XML\" style=\"margin-top: 15px; margin-bottom: 15px; padding: 8px 4px 6px; outline: 0px; overflow: visible; font-family: var(--monospace); font-size: 0.9em; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: #f8f8f8; border-radius: 3px; width: inherit; letter-spacing: normal; visibility: visible; border: 1px solid #e7eaed;\" spellcheck=\"false\"><span style=\"padding-right: 0.1px; outline: 0px; color: #333333; visibility: visible;\" role=\"presentation\"><span style=\"outline: 0px; color: #117700; visibility: visible;\">&lt;<\/span><span style=\"outline: 0px; color: #117700; visibility: visible;\">bean<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc; visibility: visible;\">id<\/span>=<span style=\"outline: 0px; color: #aa1111; visibility: visible;\">\"role\"<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc; visibility: visible;\">class<\/span>=<span style=\"outline: 0px; color: #aa1111; visibility: visible;\">\"com.wbg.springxmlbean.entity.Role\"<\/span><span style=\"outline: 0px; color: #117700; visibility: visible;\">&gt;<\/span><\/span><\/pre>\n<p style=\"outline: 0px; color: #333333; visibility: visible;\"><span style=\"padding-right: 0.1px; outline: 0px; visibility: visible;\" role=\"presentation\">\u00a0 \u00a0<span style=\"outline: 0px; color: #aa5500; visibility: visible;\">&lt;!-- property\u5143\u7d20\u662f\u5b9a\u4e49\u7c7b\u7684\u5c5e\u6027\uff0c<\/span><\/span><\/p>\n<p style=\"outline: 0px; color: #333333; visibility: visible;\"><span style=\"padding-right: 0.1px; outline: 0px; visibility: visible;\" role=\"presentation\"><span style=\"outline: 0px; color: #aa5500; visibility: visible;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 name\u5c5e\u6027\u5b9a\u4e49\u7684\u662f\u5c5e\u6027\u540d\u79f0\u00a0<\/span><\/span><\/p>\n<p style=\"outline: 0px; color: #333333; visibility: visible;\"><span style=\"padding-right: 0.1px; outline: 0px; visibility: visible;\" role=\"presentation\"><span style=\"outline: 0px; color: #aa5500; visibility: visible;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0value\u662f\u503c<\/span><\/span><span style=\"padding-right: 0.1px; outline: 0px; visibility: visible;\" role=\"presentation\"><span style=\"outline: 0px; color: #aa5500; visibility: visible;\">\u76f8\u5f53\u4e8e\uff1a<\/span><\/span><\/p>\n<pre lang=\"XML\" style=\"margin-top: 15px; margin-bottom: 15px; padding: 8px 4px 6px; outline: 0px; overflow: visible; font-family: var(--monospace); font-size: 0.9em; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: #f8f8f8; border-radius: 3px; width: inherit; letter-spacing: normal; visibility: visible; border: 1px solid #e7eaed;\" spellcheck=\"false\"><span style=\"padding-right: 0.1px; outline: 0px; color: #333333; visibility: visible;\" role=\"presentation\">\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0<span style=\"outline: 0px; color: #aa5500; visibility: visible;\">Role role=new Role();<\/span><\/span><br style=\"outline: 0px; visibility: visible;\" \/><span style=\"padding-right: 0.1px; outline: 0px; visibility: visible;\" role=\"presentation\"><span style=\"outline: 0px; visibility: visible;\"><span style=\"outline: 0px; color: #333333; visibility: visible;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><\/span><span style=\"outline: 0px; color: #aa5500; visibility: visible;\">role.setId(1);<\/span><\/span><br style=\"outline: 0px; visibility: visible;\" \/><span style=\"padding-right: 0.1px; outline: 0px; color: #333333;\" role=\"presentation\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<span style=\"outline: 0px; color: #aa5500;\">role.setRoleName(\"\u9ad8\u7ea7\u5de5\u7a0b\u5e08\");<\/span><\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px; color: #333333;\" role=\"presentation\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<span style=\"outline: 0px; color: #aa5500;\">role.setNote(\"\u91cd\u8981\u4eba\u5458\");--&gt;<\/span><\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px; color: #333333;\" role=\"presentation\">\u00a0 \u00a0<span style=\"outline: 0px; color: #117700;\">&lt;<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">name<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"id\"<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">value<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"1\"<\/span><span style=\"outline: 0px; color: #117700;\">\/&gt;<\/span><\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px; color: #333333;\" role=\"presentation\">\u00a0 \u00a0<span style=\"outline: 0px; color: #117700;\">&lt;<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">name<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"roleName\"<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">value<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"\u9ad8\u7ea7\u5de5\u7a0b\u5e08\"<\/span><span style=\"outline: 0px; color: #117700;\">\/&gt;<\/span><\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px; color: #333333;\" role=\"presentation\">\u00a0 \u00a0<span style=\"outline: 0px; color: #117700;\">&lt;<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">name<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"note\"<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">value<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"\u91cd\u8981\u4eba\u5458\"<\/span><span style=\"outline: 0px; color: #117700;\">\/&gt;<\/span><\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px; color: #333333;\" role=\"presentation\"><span style=\"outline: 0px; color: #117700;\">&lt;\/<\/span><span style=\"outline: 0px; color: #117700;\">bean<\/span><span style=\"outline: 0px; color: #117700;\">&gt;<\/span><\/span><\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">2\u3001BeanDefination\uff1a<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u5728Java\u4e16\u754c\u4e2d\uff0c\u4e07\u7269\u7686\u5bf9\u8c61\uff0c\u6563\u843d\u4e8e\u7a0b\u5e8f\u4ee3\u7801\u5404\u5904\u7684\u6ce8\u89e3\u4ee5\u53ca\u4fdd\u5b58\u5728\u78c1\u76d8\u4e0a\u7684xml\u6216\u8005\u5176\u4ed6\u6587\u4ef6\u7b49\u7b49\u914d\u7f6e\u5143\u4fe1\u606f\uff0c\u5728\u5185\u5b58\u4e2d\u603b\u8981\u4ee5\u4e00\u79cd\u5bf9\u8c61\u7684\u5f62\u5f0f\u8868\u793a\uff0c\u5c31\u597d\u6bd4\u6211\u4eec\u6d3b\u751f\u751f\u7684\u4eba\u5bf9\u5e94\u5230Java\u4e16\u754c\u4e2d\u5c31\u662f\u4e00\u4e2aPerson\u7c7b\uff0c\u800cSpring\u9009\u62e9\u5728\u5185\u5b58\u4e2d\u8868\u793a\u8fd9\u4e9b\u914d\u7f6e\u5143\u4fe1\u606f\u7684\u65b9\u5f0f\u5c31\u662fBeanDefination\uff0c\u8fd9\u91cc\u6211\u4eec\u4e0d\u4f1a\u53bb\u5206\u6790BeanDefination\u7684\u4ee3\u7801\uff0c\u8fd9\u91cc\u6211\u4eec\u53ea\u9700\u8981\u77e5\u9053\u914d\u7f6e\u5143\u4fe1\u606f\u88ab\u52a0\u8f7d\u5230\u5185\u5b58\u4e4b\u540e\u662f\u4ee5BeanDefination\u7684\u5f62\u5b58\u5728\u7684\u5373\u53ef\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">3\u3001BeanDefinationReader\uff1a<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">Spring\u662f\u5982\u4f55\u770b\u61c2\u8fd9\u4e9b\u914d\u7f6e\u5143\u4fe1\u606f\u7684\u5462\uff1f\u8fd9\u4e2a\u5c31\u8981\u9760\u6211\u4eec\u7684BeanDefinationReader\u4e86\u3002\u4e0d\u540c\u7684BeanDefinationReader\u62e5\u6709\u4e0d\u540c\u7684\u529f\u80fd\uff0c\u5982\u679c\u6211\u4eec\u8981\u8bfb\u53d6xml\u914d\u7f6e\u5143\u4fe1\u606f\uff0c\u90a3\u4e48\u53ef\u4ee5\u4f7f\u7528XmlBeanDefinationReader\u3002\u5982\u679c\u6211\u4eec\u8981\u8bfb\u53d6properties\u914d\u7f6e\u6587\u4ef6\uff0c\u90a3\u4e48\u53ef\u4ee5\u4f7f\u7528PropertiesBeanDefinitionReader\u52a0\u8f7d\u3002\u800c\u5982\u679c\u6211\u4eec\u8981\u8bfb\u53d6\u6ce8\u89e3\u914d\u7f6e\u5143\u4fe1\u606f\uff0c\u90a3\u4e48\u53ef\u4ee5\u4f7f\u7528 AnnotatedBeanDefinitionReader\u52a0\u8f7d\u3002\u6211\u4eec\u4e5f\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u81ea\u5b9a\u4e49BeanDefinationReader\u6765\u81ea\u5df1\u63a7\u5236\u914d\u7f6e\u5143\u4fe1\u606f\u7684\u52a0\u8f7d\u3002\u603b\u7684\u6765\u8bf4\uff0cBeanDefinationReader\u7684\u4f5c\u7528\u5c31\u662f\u52a0\u8f7d\u914d\u7f6e\u5143\u4fe1\u606f\uff0c\u5e76\u5c06\u5176\u8f6c\u5316\u4e3a\u5185\u5b58\u5f62\u5f0f\u7684BeanDefination\uff0c\u5b58\u5728\u67d0\u4e00\u4e2a\u5730\u65b9\uff0c\u81f3\u4e8e\u8fd9\u4e2a\u5730\u65b9\u5728\u54ea\u91cc\uff0c\u4e0d\u8981\u7740\u6025\uff0c\u63a5\u7740\u5f80\u4e0b\u770b\uff01<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">4\u3001BeanDefinationRegistry\uff1a<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u6267\u884c\u5230\u8fd9\u91cc\uff0cSpring\u5df2\u7ecf\u5c06\u5b58\u5728\u4e8e\u5404\u5904\u7684\u914d\u7f6e\u5143\u4fe1\u606f\u52a0\u8f7d\u5230\u5185\u5b58\uff0c\u5e76\u8f6c\u5316\u4e3aBeanDefination\u7684\u5f62\u5f0f\uff0c\u8fd9\u6837\u6211\u4eec\u9700\u8981\u521b\u5efa\u67d0\u4e00\u4e2a\u5bf9\u8c61\u5b9e\u4f8b\u7684\u65f6\u5019\uff0c\u627e\u5230\u76f8\u5e94\u7684BeanDefination\u7136\u540e\u521b\u5efa\u5bf9\u8c61\u5373\u53ef\u3002\u90a3\u4e48\u6211\u4eec\u9700\u8981\u67d0\u4e00\u4e2a\u5bf9\u8c61\u7684\u65f6\u5019\uff0c\u53bb\u54ea\u91cc\u627e\u5230\u5bf9\u5e94\u7684BeanDefination\u5462\uff1f\u8fd9\u79cd\u901a\u8fc7Bean\u5b9a\u4e49\u7684id\u627e\u5230\u5bf9\u8c61\u7684BeanDefination\u7684\u5bf9\u5e94\u5173\u7cfb\u6216\u8005\u8bf4\u6620\u5c04\u5173\u7cfb\u53c8\u662f\u5982\u4f55\u4fdd\u5b58\u7684\u5462\uff1f\u8fd9\u5c31\u5f15\u51fa\u4e86BeanDefinationRegistry\u4e86\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">Spring\u901a\u8fc7BeanDefinationReader\u5c06\u914d\u7f6e\u5143\u4fe1\u606f\u52a0\u8f7d\u5230\u5185\u5b58\u751f\u6210\u76f8\u5e94\u7684BeanDefination\u4e4b\u540e\uff0c\u5c31\u5c06\u5176\u6ce8\u518c\u5230BeanDefinationRegistry\u4e2d\uff0cBeanDefinationRegistry\u5c31\u662f\u4e00\u4e2a\u5b58\u653eBeanDefination\u7684\u5927\u7bee\u5b50\uff0c\u5b83\u4e5f\u662f\u4e00\u79cd\u952e\u503c\u5bf9\u7684\u5f62\u5f0f\uff0c\u901a\u8fc7\u7279\u5b9a\u7684Bean\u5b9a\u4e49\u7684id\uff0c\u6620\u5c04\u5230\u76f8\u5e94\u7684BeanDefination\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">5\u3001BeanFactoryPostProcessor\uff1a<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">BeanFactoryPostProcessor\u662f\u5bb9\u5668\u542f\u52a8\u9636\u6bb5Spring\u63d0\u4f9b\u7684\u4e00\u4e2a\u6269\u5c55\u70b9\uff0c\u4e3b\u8981\u8d1f\u8d23\u5bf9\u6ce8\u518c\u5230BeanDefinationRegistry\u4e2d\u7684\u4e00\u4e2a\u4e2a\u7684BeanDefination\u8fdb\u884c\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u7684\u4fee\u6539\u4e0e\u66ff\u6362\u3002\u4f8b\u5982\u6211\u4eec\u7684\u914d\u7f6e\u5143\u4fe1\u606f\u4e2d\u6709\u4e9b\u53ef\u80fd\u4f1a\u4fee\u6539\u7684\u914d\u7f6e\u4fe1\u606f\u6563\u843d\u5230\u5404\u5904\uff0c\u4e0d\u591f\u7075\u6d3b\uff0c\u4fee\u6539\u76f8\u5e94\u914d\u7f6e\u7684\u65f6\u5019\u6bd4\u8f83\u9ebb\u70e6\uff0c\u8fd9\u65f6\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u5360\u4f4d\u7b26\u7684\u65b9\u5f0f\u6765\u914d\u7f6e\u3002\u4f8b\u5982\u914d\u7f6eJdbc\u7684DataSource\u8fde\u63a5\u7684\u65f6\u5019\u53ef\u4ee5\u8fd9\u6837\u914d\u7f6e\uff1a<\/span><\/p>\n<pre lang=\"XML\" style=\"margin-top: 15px; margin-bottom: 15px; padding: 8px 4px 6px; outline: 0px; overflow: visible; font-family: var(--monospace); font-size: 0.9em; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: #f8f8f8; border-radius: 3px; width: inherit; color: #333333; letter-spacing: normal; border: 1px solid #e7eaed;\" spellcheck=\"false\"><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\"><span style=\"outline: 0px; color: #117700;\">&lt;<\/span><span style=\"outline: 0px; color: #117700;\">bean<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">id<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"dataSource\"<\/span>\u00a0\u00a0<\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\">\u00a0 \u00a0<span style=\"outline: 0px; color: #0000cc;\">class<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"org.apache.commons.dbcp.BasicDataSource\"<\/span>\u00a0\u00a0<\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\">\u00a0 \u00a0<span style=\"outline: 0px; color: #0000cc;\">destroy-method<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"close\"<\/span><span style=\"outline: 0px; color: #117700;\">&gt;<\/span>\u00a0\u00a0<\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\">\u00a0 \u00a0<span style=\"outline: 0px; color: #117700;\">&lt;<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">name<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"maxIdle\"<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">value<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"${jdbc.maxIdle}\"<\/span><span style=\"outline: 0px; color: #117700;\">&gt;&lt;\/<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span><span style=\"outline: 0px; color: #117700;\">&gt;<\/span>\u00a0\u00a0<\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\">\u00a0 \u00a0<span style=\"outline: 0px; color: #117700;\">&lt;<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">name<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"maxActive\"<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">value<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"${jdbc.maxActive}\"<\/span><span style=\"outline: 0px; color: #117700;\">&gt;&lt;\/<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span><span style=\"outline: 0px; color: #117700;\">&gt;<\/span>\u00a0\u00a0<\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\">\u00a0 \u00a0<span style=\"outline: 0px; color: #117700;\">&lt;<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">name<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"maxWait\"<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">value<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"${jdbc.maxWait}\"<\/span><span style=\"outline: 0px; color: #117700;\">&gt;&lt;\/<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span><span style=\"outline: 0px; color: #117700;\">&gt;<\/span>\u00a0\u00a0<\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\">\u00a0 \u00a0<span style=\"outline: 0px; color: #117700;\">&lt;<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">name<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"minIdle\"<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">value<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"${jdbc.minIdle}\"<\/span><span style=\"outline: 0px; color: #117700;\">&gt;&lt;\/<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span><span style=\"outline: 0px; color: #117700;\">&gt;<\/span>\u00a0\u00a0<\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\">\u00a0 \u00a0<span style=\"outline: 0px; color: #117700;\">&lt;<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">name<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"driverClassName\"<\/span>\u00a0<\/span><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\">\u00a0<span style=\"outline: 0px; color: #0000cc;\">value<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"${jdbc.driverClassName}\"<\/span><span style=\"outline: 0px; color: #117700;\">&gt;<\/span>\u00a0\u00a0<\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\">\u00a0 \u00a0<span style=\"outline: 0px; color: #117700;\">&lt;\/<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span><span style=\"outline: 0px; color: #117700;\">&gt;<\/span>\u00a0\u00a0<\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\">\u00a0 \u00a0<span style=\"outline: 0px; color: #117700;\">&lt;<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">name<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"url\"<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">value<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"${jdbc.url}\"<\/span><span style=\"outline: 0px; color: #117700;\">&gt;&lt;\/<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span><span style=\"outline: 0px; color: #117700;\">&gt;<\/span>\u00a0\u00a0<\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\">\u00a0 \u00a0<span style=\"outline: 0px; color: #117700;\">&lt;<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">name<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"username\"<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">value<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"${jdbc.username}\"<\/span><span style=\"outline: 0px; color: #117700;\">&gt;&lt;\/<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span><span style=\"outline: 0px; color: #117700;\">&gt;<\/span>\u00a0\u00a0<\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\">\u00a0 \u00a0<span style=\"outline: 0px; color: #117700;\">&lt;<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">name<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"password\"<\/span>\u00a0<span style=\"outline: 0px; color: #0000cc;\">value<\/span>=<span style=\"outline: 0px; color: #aa1111;\">\"${jdbc.password}\"<\/span><span style=\"outline: 0px; color: #117700;\">&gt;&lt;\/<\/span><span style=\"outline: 0px; color: #117700;\">property<\/span><span style=\"outline: 0px; color: #117700;\">&gt;<\/span>\u00a0\u00a0<\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\"><span style=\"outline: 0px; color: #117700;\">&lt;\/<\/span><span style=\"outline: 0px; color: #117700;\">bean<\/span><span style=\"outline: 0px; color: #117700;\">&gt;<\/span><\/span><\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">BeanFactoryPostProcessor\u5c31\u4f1a\u5bf9\u6ce8\u518c\u5230BeanDefinationRegistry\u4e2d\u7684BeanDefination\u505a\u6700\u540e\u7684\u4fee\u6539\uff0c\u66ff\u6362$\u5360\u4f4d\u7b26\u4e3a\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u771f\u5b9e\u7684\u6570\u636e\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u81f3\u6b64\uff0c\u6574\u4e2a\u5bb9\u5668\u542f\u52a8\u9636\u6bb5\u5c31\u7b97\u5b8c\u6210\u4e86\uff0c\u5bb9\u5668\u7684\u542f\u52a8\u9636\u6bb5\u7684\u6700\u7ec8\u4ea7\u7269\u5c31\u662f\u6ce8\u518c\u5230BeanDefinationRegistry\u4e2d\u7684\u4e00\u4e2a\u4e2aBeanDefination\u4e86\uff0c\u8fd9\u5c31\u662fSpring\u4e3aBean\u5b9e\u4f8b\u5316\u6240\u505a\u7684\u9884\u70ed\u7684\u5de5\u4f5c\u3002\u8ba9\u6211\u4eec\u518d\u901a\u8fc7\u4e00\u5f20\u56fe\u7684\u5f62\u5f0f\u56de\u987e\u4e00\u4e0b\u5bb9\u5668\u542f\u52a8\u9636\u6bb5\u90fd\u662f\u641e\u4e86\u4ec0\u4e48\u4e8b\u5427\u3002<\/span><\/p>\n<p style=\"outline: 0px; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; text-wrap: wrap; background-color: #ffffff; text-align: left;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" style=\"outline: 0px; width: 677px !important; visibility: visible !important;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154118814.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-galleryid=\"\" data-ratio=\"0.7191316146540027\" data-s=\"300,640\" data-type=\"png\" data-w=\"737\" \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" style=\"outline: 0px; width: 677px !important; visibility: visible !important;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154118814.png\" data-galleryid=\"\" data-ratio=\"0.7191316146540027\" data-s=\"300,640\" data-type=\"png\" data-w=\"737\" \/><\/noscript><\/p>\n<h2 style=\"margin-top: 1rem; margin-bottom: 1rem; outline: 0px; font-weight: bold; font-size: 1.75em; background-color: #ffffff; white-space: pre-wrap; break-after: avoid-page; break-inside: avoid; orphans: 4; line-height: 1.225; cursor: text; border-bottom: 1px solid #eeeeee; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u4e8c\u3001Bean\u7684\u83b7\u53d6\u9636\u6bb5\uff1a<\/span><\/h2>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u5728\u5bb9\u5668\u542f\u52a8\u9636\u6bb5\uff0c\u5df2\u7ecf\u5b8c\u6210\u4e86bean\u7684\u6ce8\u518c\u3002\u5982\u679c\u8be5\u5bf9\u8c61\u662f\u914d\u7f6e\u6210\u61d2\u52a0\u8f7d\u7684\u65b9\u5f0f\uff0c\u90a3\u4e48\u76f4\u5230\u6211\u4eec\u5411Spring\u8981\u4f9d\u8d56\u5bf9\u8c61\u5b9e\u4f8b\u4e4b\u524d\uff0c\u5176\u90fd\u662f\u4ee5BeanDefinationRegistry\u4e2d\u7684\u4e00\u4e2a\u4e2a\u7684BeanDefination\u7684\u5f62\u5f0f\u5b58\u5728\uff0c\u4e5f\u5c31\u662fSpring\u53ea\u6709\u5728\u6211\u4eec\u7b2c\u4e00\u6b21\u4f9d\u8d56\u5bf9\u8c61\u7684\u65f6\u5019\u624d\u5f00\u542f\u76f8\u5e94\u5bf9\u8c61\u7684\u5b9e\u4f8b\u5316\u9636\u6bb5\u3002\u800c\u5982\u679c\u6211\u4eec\u4e0d\u662f\u9009\u62e9\u61d2\u52a0\u8f7d\u7684\u65b9\u5f0f\uff0c\u5bb9\u5668\u542f\u52a8\u9636\u6bb5\u5b8c\u6210\u4e4b\u540e\uff0c\u5176\u4e2d\u6709\u4e00\u4e2a\u6b65\u9aa4finishBeanFactoryInitialization()\uff0c\u5728\u8fd9\u4e00\u6b65\u5c06\u7acb\u5373\u542f\u52a8Bean\u5b9e\u4f8b\u5316\u9636\u6bb5\uff0c\u901a\u8fc7\u9690\u5f0f\u7684\u8c03\u7528\u6240\u6709\u4f9d\u8d56\u5bf9\u8c61\u7684getBean\u65b9\u6cd5\u6765\u5b9e\u4f8b\u5316\u6240\u6709\u914d\u7f6e\u7684Bean\uff0c\u5b8c\u6210\u7c7b\u7684\u52a0\u8f7d\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">1\u3001doGetBean()\uff1abean\u7684\u83b7\u53d6\uff1a<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">doGetBean()\u7684\u603b\u4f53\u529f\u80fd\u5c31\u662f\u5728\u521b\u5efabean\u5bf9\u8c61\u4e4b\u524d\uff0c\u5148\u53bb\u7f13\u5b58\u6216\u8005beanFactory\u5de5\u5382\u4e2d\u67e5\u770b\u662f\u5426\u5b58\u5728bean\uff0c\u5982\u679c\u5b58\u5728\uff0c\u5219\u8fd4\u56de\uff0c\u4e0d\u5b58\u5728\uff0c\u5219\u8fdb\u884c\u5bf9\u5e94\u7684\u521b\u5efa\u6d41\u7a0b\u3002\u6211\u4eec\u5148\u627e\u5230doGetBean()\u65b9\u6cd5\u7684\u5165\u53e3\uff0c\u9605\u8bfb\u4e00\u4e0b\u8fd9\u4e2a\u65b9\u6cd5\u7684\u6e90\u7801\uff1a<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u9996\u5148\u8c03\u7528 ApplicationContext.getBean(\"beanName\")\u83b7\u53d6Bean\u5bf9\u8c61\uff1a<\/span><\/p>\n<pre lang=\"java\" style=\"margin-top: 15px; margin-bottom: 15px; padding: 8px 4px 6px; outline: 0px; overflow: visible; font-family: var(--monospace); font-size: 0.9em; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: #f8f8f8; border-radius: 3px; width: inherit; color: #333333; letter-spacing: normal; border: 1px solid #e7eaed;\" spellcheck=\"false\"><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\"><span style=\"outline: 0px; color: #000000;\">applicationContext<\/span>.<span style=\"outline: 0px; color: #000000;\">getBean<\/span>(<span style=\"outline: 0px; color: #aa1111;\">\"name\"<\/span>);<\/span><\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u7136\u540e\u518d\u8c03\u7528AbstractApplicationContext.getBean(\"beanName\")\uff1a<\/span><\/p>\n<pre lang=\"java\" style=\"margin-top: 15px; margin-bottom: 15px; padding: 8px 4px 6px; outline: 0px; overflow: visible; font-family: var(--monospace); font-size: 0.9em; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: #f8f8f8; border-radius: 3px; width: inherit; color: #333333; letter-spacing: normal; border: 1px solid #e7eaed;\" spellcheck=\"false\"><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\">\u00a0 \u00a0<span style=\"outline: 0px; color: #770088;\">public<\/span>\u00a0<span style=\"outline: 0px; color: #008855;\">Object<\/span>\u00a0<span style=\"outline: 0px; color: #0000ff;\">getBean<\/span>(<span style=\"outline: 0px; color: #008855;\">String<\/span>\u00a0<span style=\"outline: 0px; color: #000000;\">name<\/span>)\u00a0<span style=\"outline: 0px; color: #770088;\">throws<\/span>\u00a0<span style=\"outline: 0px; color: #000000;\">BeansException<\/span>\u00a0{<\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\">\u00a0 \u00a0 \u00a0 \u00a0<span style=\"outline: 0px; color: #000000;\">assertBeanFactoryActive<\/span>();\u3000<\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\">\u00a0 \u00a0 \u00a0 \u00a0<span style=\"outline: 0px; color: #aa5500;\">\/\/ \u8c03\u7528getBean \u8fdb\u5165AbstractBeanFactory\u3000\u3000\u3000\u3000<\/span><\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\">\u00a0 \u00a0 \u00a0 \u00a0<span style=\"outline: 0px; color: #770088;\">return<\/span>\u00a0<span style=\"outline: 0px; color: #000000;\">getBeanFactory<\/span>().<span style=\"outline: 0px; color: #000000;\">getBean<\/span>(<span style=\"outline: 0px; color: #000000;\">name<\/span>);<\/span><br style=\"outline: 0px;\" \/><span style=\"padding-right: 0.1px; outline: 0px;\" role=\"presentation\">\u00a0 }<\/span><\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u518d\u8c03\u7528AbstractBeanFactory\u7c7b\u4e0b\u9762\u7684doGetBean()\u65b9\u6cd5<\/span><\/p>\n<section>\n<pre data-lang=\"typescript\">protected &lt;T&gt; T doGetBean(      final String name, final Class&lt;T&gt; requiredType, final Object[] args, boolean typeCheckOnly)      throws BeansException {         \/*        1\u3001\u8f6c\u6362beanName(\u522b\u540d\u8f6c\u6362)\uff1a\u4f20\u5165\u7684\u53c2\u6570name\u53ef\u80fd\u53ea\u662f\u522b\u540d\uff0c\u4e5f\u53ef\u80fd\u662fFactoryBean\uff0c\u6240\u4ee5\u9700\u8981\u8fdb\u884c\u89e3\u6790\u8f6c\u6362\uff1a        \uff081\uff09\u6d88\u9664\u4fee\u9970\u7b26\uff0c\u6bd4\u5982\u5de5\u5382\u5f15\u7528\u524d\u7f00 String FACTORY_BEAN_PREFIX = \"&amp;\";        \uff082\uff09\u89e3\u51b3spring\u4e2dalias\u6807\u7b7e\u7684\u522b\u540d\u95ee\u9898        *\/     final String beanName = transformedBeanName(name);    Object bean;         \/\/2\u3001\u5c1d\u8bd5\u4ece\u7f13\u5b58\u4e2d\u53bb\u52a0\u8f7d\u5b9e\u4f8b\uff0c\u5982\u679c\u83b7\u53d6\u5230\u4e86\u5c31\u76f4\u63a5\u8fd4\u56de    \/\/ Eagerly check singleton cache for manually registered singletons.    Object sharedInstance = getSingleton(beanName);    \/\/\u5982\u679c\u7f13\u5b58\u4e2d\u5b58\u5728\u5bf9\u5e94\u7684bean    if (sharedInstance != null &amp;&amp; args == null) {      if (logger.isDebugEnabled()) {        if (isSingletonCurrentlyInCreation(beanName)) {          logger.debug(\"Returning eagerly cached instance of singleton bean '\" + beanName +              \"' that is not fully initialized yet - a consequence of a circular reference\");        }        else {          logger.debug(\"Returning cached instance of singleton bean '\" + beanName + \"'\");        }      }            \/\/3\u3001\u7f13\u5b58\u6e20\u9053\u7684bean\u7684\u5b9e\u4f8b\u5316\u3002\u4ece\u7f13\u5b58\u4e2d\u83b7\u53d6\u7684bean\u662f\u539f\u59cb\u72b6\u6001\u7684bean,\u9700\u8981\u5728\u8fd9\u91cc\u5bf9bean\u8fdb\u884cbean\u5b9e\u4f8b\u5316\u3002      \/\/ \u6b64\u65f6\u4f1a\u8fdb\u884c \u5408\u5e76RootBeanDefinition\u3001BeanPostProcessor\u8fdb\u884c\u5b9e\u4f8b\u524d\u7f6e\u5904\u7406\u3001\u5b9e\u4f8b\u5316\u3001\u5b9e\u4f8b\u540e\u7f6e\u5904\u7406\u3002      bean = getObjectForBeanInstance(sharedInstance, name, beanName, null);    }        \/\/ \u5982\u679c\u7f13\u5b58\u4e2d\u6ca1\u6709\u5bf9\u5e94bean    else {         \/\/4\u3001\u5faa\u73af\u4f9d\u8d56\u68c0\u67e5\u3002 (\u6784\u9020\u5668\u7684\u5faa\u73af\u4f9d\u8d56)\u5faa\u73af\u4f9d\u8d56\u5b58\u5728\uff0c\u5219\u62a5\u9519\u3002      \/\/ Fail if we're already creating this bean instance:      \/\/ We're assumably within a circular reference.      if (isPrototypeCurrentlyInCreation(beanName)) {        throw new BeanCurrentlyInCreationException(beanName);      }             \/\/ 5\u3001\u5982\u679c\u7f13\u5b58\u4e2d\u6ca1\u6709\u6570\u636e\uff0c\u5c31\u4f1a\u8f6c\u5230\u7236\u7c7b\u5de5\u5382\u53bb\u52a0\u8f7d            \/\/\u83b7\u53d6\u7236\u5de5\u5382      \/\/ Check if bean definition exists in this factory.      BeanFactory parentBeanFactory = getParentBeanFactory();                  \/\/!containsBeanDefinition(beanName)\u5c31\u662f\u68c0\u6d4b\u5982\u679c\u5f53\u524d\u52a0\u8f7d\u7684xml\u914d\u7f6e\u6587\u4ef6\u4e2d\u4e0d\u5305\u542bbeanName\u6240\u5bf9\u5e94\u7684\u914d\u7f6e\uff0c\u5c31\u53ea\u80fd\u5230parentBeanFacotory\u53bb\u5c1d\u8bd5\u52a0\u8f7dbean\u3002      if (parentBeanFactory != null &amp;&amp; !containsBeanDefinition(beanName)) {        \/\/ Not found -&gt; check parent.        String nameToLookup = originalBeanName(name);        if (args != null) {          \/\/ Delegation to parent with explicit args.          return (T) parentBeanFactory.getBean(nameToLookup, args);        }        else {          \/\/ No args -&gt; delegate to standard getBean method.          return parentBeanFactory.getBean(nameToLookup, requiredType);        }      }       if (!typeCheckOnly) {        markBeanAsCreated(beanName);      }             \/\/6\u3001\u5b58\u50a8XML\u914d\u7f6e\u6587\u4ef6\u7684GernericBeanDefinition\u8f6c\u6362\u6210RootBeanDefinition\uff0c\u5373\u4e3a\u5408\u5e76\u7236\u7c7b\u5b9a\u4e49\u3002      try {                \/\/ XML\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bfb\u53d6\u5230\u7684bean\u4fe1\u606f\u662f\u5b58\u50a8\u5728GernericBeanDefinition\u4e2d\u7684\uff0c\u4f46Bean\u7684\u540e\u7eed\u5904\u7406\u662f\u9488\u5bf9\u4e8eRootBeanDefinition\u7684\uff0c\u6240\u4ee5\u9700\u8981\u8f6c\u6362\u540e\u624d\u80fd\u8fdb\u884c\u540e\u7eed\u64cd\u4f5c\u3002        final RootBeanDefinition mbd = getMergedLocalBeanDefinition(beanName);        checkMergedBeanDefinition(mbd, beanName, args);         \/\/ Guarantee initialization of beans that the current bean depends on.        \/\/7\u3001\u521d\u59cb\u5316\u4f9d\u8d56\u7684bean        String[] dependsOn = mbd.getDependsOn();        \/\/bean\u4e2d\u53ef\u80fd\u4f9d\u8d56\u4e86\u5176\u4ed6bean\u5c5e\u6027\uff0c\u5728\u521d\u59cb\u5316bean\u4e4b\u524d\u4f1a\u5148\u521d\u59cb\u5316\u8fd9\u4e2abean\u6240\u4f9d\u8d56\u7684bean\u5c5e\u6027\u3002        if (dependsOn != null) {          for (String dependsOnBean : dependsOn) {            if (isDependent(beanName, dependsOnBean)) {              throw new BeanCreationException(mbd.getResourceDescription(), beanName,                  \"Circular depends-on relationship between '\" + beanName + \"' and '\" + dependsOnBean + \"'\");            }            registerDependentBean(dependsOnBean, beanName);            getBean(dependsOnBean);          }        }                 \/\/8\u3001\u521b\u5efabean        \/\/ Create bean instance.        if (mbd.isSingleton()) {          sharedInstance = getSingleton(beanName, new ObjectFactory&lt;Object&gt;() {            @Override            public Object getObject() throws BeansException {              try {                return createBean(beanName, mbd, args);              }              catch (BeansException ex) {                \/\/ Explicitly remove instance from singleton cache: It might have been put there                \/\/ eagerly by the creation process, to allow for circular reference resolution.                \/\/ Also remove any beans that received a temporary reference to the bean.                destroySingleton(beanName);                throw ex;              }            }          });          bean = getObjectForBeanInstance(sharedInstance, name, beanName, mbd);        }         else if (mbd.isPrototype()) {          \/\/ It's a prototype -&gt; create a new instance.          Object prototypeInstance = null;          try {            beforePrototypeCreation(beanName);            prototypeInstance = createBean(beanName, mbd, args);          }          finally {            afterPrototypeCreation(beanName);          }          bean = getObjectForBeanInstance(prototypeInstance, name, beanName, mbd);        }         else {          String scopeName = mbd.getScope();          final Scope scope = this.scopes.get(scopeName);          if (scope == null) {            throw new IllegalStateException(\"No Scope registered for scope name '\" + scopeName + \"'\");          }          try {            Object scopedInstance = scope.get(beanName, new ObjectFactory&lt;Object&gt;() {              @Override              public Object getObject() throws BeansException {                beforePrototypeCreation(beanName);                try {                  return createBean(beanName, mbd, args);                }                finally {                  afterPrototypeCreation(beanName);                }              }            });            bean = getObjectForBeanInstance(scopedInstance, name, beanName, mbd);          }          catch (IllegalStateException ex) {            throw new BeanCreationException(beanName,                \"Scope '\" + scopeName + \"' is not active for the current thread; consider \" +                \"defining a scoped proxy for this bean if you intend to refer to it from a singleton\",                ex);          }        }      }      catch (BeansException ex) {        cleanupAfterBeanCreationFailure(beanName);        throw ex;      }    }     \/\/ Check if required type matches the type of the actual bean instance.    if (requiredType != null &amp;&amp; bean != null &amp;&amp; !requiredType.isAssignableFrom(bean.getClass())) {      try {        return getTypeConverter().convertIfNecessary(bean, requiredType);      }      catch (TypeMismatchException ex) {        if (logger.isDebugEnabled()) {          logger.debug(\"Failed to convert bean '\" + name + \"' to required type [\" +              ClassUtils.getQualifiedName(requiredType) + \"]\", ex);        }        throw new BeanNotOfRequiredTypeException(name, requiredType, bean.getClass());      }    }    return (T) bean;  }<\/pre>\n<\/section>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">2\u3001\u4ece\u7f13\u5b58\u4e2d\u83b7\u53d6\u5355\u4f8bbean\uff1agetSingleton(String beanName, boolean allowEarlyReference)<\/strong><\/span><\/p>\n<section>\n<pre data-lang=\"kotlin\">protected Object getSingleton(String beanName, boolean allowEarlyReference) {\u00a0\u00a0\/\/\u00a0\u4ece\u7f13\u5b58\u6c60\u4e2d\u83b7\u53d6bean\uff1asingletonObjects\u00a0\u4e00\u7ea7\u7f13\u00a0\u00a0Object\u00a0singletonObject\u00a0=\u00a0this.singletonObjects.get(beanName);\n\u00a0\u00a0\/\/\u00a0\u5982\u679c\u4e00\u7ea7\u7f13\u5b58\u4e2d\u4e3anull\uff0c\u518d\u5224\u65ad\u662f\u5426\u6b63\u5728\u521b\u5efa  if (singletonObject == null &amp;&amp; isSingletonCurrentlyInCreation(beanName)) {    \/\/ \u52a0\u9501\uff0c\u9632\u6b62\u5e76\u53d1\u521b\u5efa    synchronized (this.singletonObjects) {      \/\/ \u4ece\u4e8c\u7ea7\u7f13\u5b58\u4e2d\u83b7\u53d6bean\uff0c\u5982\u679c\u6b64 bean \u6b63\u5728\u52a0\u8f7d\u5219\u4e0d\u5904\u7406      singletonObject = this.earlySingletonObjects.get(beanName);\u00a0\u00a0    if\u00a0(singletonObject\u00a0==\u00a0null\u00a0&amp;&amp;\u00a0allowEarlyReference)\u00a0{        \/\/ \u5f53\u67d0\u4e9b\u65b9\u6cd5\u9700\u8981\u63d0\u524d\u521d\u59cb\u5316\uff0c\u8c03\u7528 addSingletonFactory \u65b9\u6cd5\u5c06\u5bf9\u5e94\u7684objectFactory \u521d\u59cb\u5316\u7b56\u7565\u5b58\u50a8\u5728 singletonFactories        ObjectFactory&lt;?&gt; singletonFactory = this.singletonFactories.get(beanName);        if (singletonFactory != null) {          singletonObject = singletonFactory.getObject();          this.earlySingletonObjects.put(beanName, singletonObject);          this.singletonFactories.remove(beanName);        }      }    }  }  return singletonObject;}<\/pre>\n<\/section>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u5728 Spring \u4e2d\uff0cbean\u9ed8\u8ba4\u90fd\u662f\u5355\u4f8b\u7684\uff0c\u540c\u4e00\u4e2a\u5bb9\u5668\u7684\u5355\u4f8b\u53ea\u4f1a\u88ab\u521b\u5efa\u4e00\u6b21\uff0c\u540e\u7eed\u518d\u83b7\u53d6 bean \u65f6\uff0c\u76f4\u63a5\u4ece\u5355\u4f8b\u7f13\u5b58 singletonObjects \u4e2d\u8fdb\u884c\u83b7\u53d6\u3002\u800c\u4e14\u56e0\u4e3a\u5355\u4f8b\u7f13\u5b58\u662f\u516c\u5171\u53d8\u91cf\uff0c\u6240\u4ee5\u5bf9\u5b83\u8fdb\u884c\u64cd\u4f5c\u7684\u65f6\u5019\uff0c\u90fd\u8fdb\u884c\u4e86\u52a0\u9501\u64cd\u4f5c\uff0c\u907f\u514d\u4e86\u591a\u7ebf\u7a0b\u5e76\u53d1\u4fee\u6539\u6216\u8bfb\u53d6\u7684\u8986\u76d6\u64cd\u4f5c\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u8fd8\u6709\u8fd9\u91cc\u6709\u4e2a earlySingletonObjects \u53d8\u91cf\uff0c\u5b83\u4e5f\u662f\u5355\u4f8b\u7f13\u5b58\uff0c\u4e5f\u662f\u7528\u6765\u4fdd\u5b58 beanName \u548c \u521b\u5efa bean \u5b9e\u4f8b\u4e4b\u95f4\u7684\u5173\u7cfb\u3002\u4e0e singletonFactories \u4e0d\u540c\u7684\u662f\uff0c\u5f53\u4e00\u4e2a\u5355\u4f8b bean \u88ab\u653e\u5165\u5230\u8fd9 early \u5355\u4f8b\u7f13\u5b58\u540e\uff0c\u5c31\u8981\u4ece singletonFactories \u4e2d\u79fb\u9664\uff0c\u4e24\u8005\u662f\u4e92\u65a5\u7684\uff0c\u4e3b\u8981\u7528\u6765\u89e3\u51b3\u5faa\u73af\u4f9d\u8d56\u7684\u95ee\u9898\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">3\u3001\u4eceBean\u7684\u5b9e\u4f8b\u4e2d\u83b7\u53d6\u5bf9\u8c61\uff1agetObjectForBeanInstance()<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u5728 getBean()\u65b9\u6cd5\u4e2d\uff0cgetObjectForBeanInstance() \u662f\u4e2a\u9ad8\u9891\u65b9\u6cd5\uff0c\u5728\u5355\u4f8b\u7f13\u5b58\u4e2d\u83b7\u5f97 bean \u8fd8\u662f \u6839\u636e\u4e0d\u540c\u7684 scope \u7b56\u7565\u52a0\u8f7d bean\uff0c\u90fd\u6709\u8fd9\u4e2a\u8fd9\u4e2a\u65b9\u6cd5\u7684\u51fa\u73b0\u3002\u56e0\u4e3a\u4ece\u7f13\u5b58\u4e2d\u83b7\u53d6\u7684bean\u662f\u539f\u59cb\u72b6\u6001\u7684bean\uff0c\u9700\u8981\u5728\u8fd9\u91cc\u5bf9bean\u8fdb\u884cbean\u5b9e\u4f8b\u5316\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px; min-width: 10px; min-height: 10px; word-break: break-all; font-family: monospace; display: inline-block; width: 1140px;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" style=\"margin: auto; outline: 0px; vertical-align: middle; border-width: 0px 4px 0px 2px; image-orientation: from-image; cursor: default; display: block; width: 677px !important; visibility: visible !important; border-color: initial transparent initial transparent; border-style: initial solid initial solid;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154119505.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-ratio=\"0.8444444444444444\" data-type=\"png\" data-w=\"1080\" \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" style=\"margin: auto; outline: 0px; vertical-align: middle; border-width: 0px 4px 0px 2px; image-orientation: from-image; cursor: default; display: block; width: 677px !important; visibility: visible !important; border-color: initial transparent initial transparent; border-style: initial solid initial solid;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154119505.png\" data-ratio=\"0.8444444444444444\" data-type=\"png\" data-w=\"1080\" \/><\/noscript><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u65b9\u6cd5\u6d41\u7a0b\u5c0f\u7ed3\uff1a<\/span><\/p>\n<blockquote style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-top: 0px; padding-right: 15px; padding-left: 15px; outline: 0px; border-left-width: 4px; border-left-color: #dfe2e5; color: #777777; font-size: 16px; text-wrap: wrap; background-color: #ffffff; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; letter-spacing: normal; text-align: start;\">\n<ul class=\"list-paddingleft-1\" style=\"padding-left: 30px; outline: 0px;\" data-mark=\"-\">\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff081\uff09\u9a8c\u8bc1 bean \u7c7b\u578b\uff1a\u5224\u65ad\u662f\u5426\u662f\u5de5\u5382bean<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff082\uff09\u5bf9\u975e FactoryBean \u4e0d\u505a\u5904\u7406<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff083\uff09\u5904\u7406 FactoryBean\uff1a\u5982\u679c\u662fFactoryBean\u7c7b\u578b\uff0c\u5148\u5bf9 bean \u8fdb\u884c\u8f6c\u6362\uff0c\u518d\u59d4\u6258\u7ed9 getObjectFromFactoryBean()\u65b9\u6cd5\u8fdb\u884c\u5904\u7406\u3002<\/span><\/p>\n<\/li>\n<\/ul>\n<\/blockquote>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u5728\u8fd9\u4e2a\u65b9\u6cd5\u4e2d\uff0c\u5bf9\u5de5\u5382 bean \u6709\u7279\u6b8a\u5904\u7406\uff0c\u6700\u7ec8\u83b7\u53d6\u7684\u662f FactoryBean.getObject() \u65b9\u6cd5\u8fd4\u56de\u7684\u7c7b\u578b\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">4\u3001\u83b7\u53d6\u5355\u4f8b\uff1agetSingleton(String beanName, ObjectFactory&lt;?&gt; singletonFactory)<\/strong><\/span><\/p>\n<section>\n<pre data-lang=\"kotlin\">\/\/ Create bean instance. \u521b\u5efa bean \u5b9e\u4f8b\/\/ singleton \u5355\u4f8b\u6a21\u5f0f\uff08\u6700\u5e38\u4f7f\u7528\uff09if (mbd.isSingleton()) {    \/\/ \u7b2c\u4e8c\u4e2a\u53c2\u6570\u7684\u56de\u8c03\u63a5\u53e3\uff0c\u63a5\u53e3\u662f org.springframework.beans.factory.ObjectFactory#getObject    \/\/ \u63a5\u53e3\u5b9e\u73b0\u7684\u65b9\u6cd5\u662f createBean(beanName, mbd, args)  sharedInstance = getSingleton(beanName, () -&gt; {    return createBean(beanName, mbd, args);    \/\/ \u7701\u7565\u4e86 try \/ catch  });  bean = getObjectForBeanInstance(sharedInstance, name, beanName, mbd);}<\/pre>\n<\/section>\n<p style=\"outline: 0px; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; text-wrap: wrap; background-color: #ffffff; text-align: left;\">\u6765\u770b getSingleton() \u65b9\u6cd5\u505a\u4e86\u4ec0\u4e48\uff1a<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"kotlin\"><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\"><span class=\"code-snippet__keyword\" style=\"outline: 0px;\">public<\/span> Object getSingleton(String beanName, ObjectFactory&lt;?&gt; singletonFactory) {<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">  Assert.notNull(beanName, <span class=\"code-snippet__string\" style=\"outline: 0px;\">\"Bean name must not be null\"<\/span>);<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">  <span class=\"code-snippet__comment\" style=\"outline: 0px;\">\/\/ \u6ce8\u91ca 4.7 \u5168\u5c40\u53d8\u91cf\uff0c\u52a0\u9501<\/span><\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">  synchronized (<span class=\"code-snippet__keyword\" style=\"outline: 0px;\">this<\/span>.singletonObjects) {<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">    <span class=\"code-snippet__comment\" style=\"outline: 0px;\">\/\/1\u3001\u518d\u6b21\u68c0\u67e5\u662f\u5426\u5df2\u7ecf\u88ab\u52a0\u8f7d\u4e86\uff0c\u5355\u4f8b\u6a21\u5f0f\u5c31\u662f\u53ef\u4ee5\u590d\u7528\u5df2\u7ecf\u521b\u5efa\u7684 bean<\/span><\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">    Object singletonObject = <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">this<\/span>.singletonObjects.<span class=\"code-snippet__keyword\" style=\"outline: 0px;\">get<\/span>(beanName);<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">    <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">if<\/span> (singletonObject == <span class=\"code-snippet__literal\" style=\"outline: 0px;\">null<\/span>) {<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      <span class=\"code-snippet__comment\" style=\"outline: 0px;\">\/\/2\u3001\u521d\u59cb\u5316\u524d\u64cd\u4f5c\uff0c\u6821\u9a8c\u662f\u5426 beanName \u662f\u5426\u6709\u522b\u7684\u7ebf\u7a0b\u5728\u521d\u59cb\u5316\uff0c\u5e76\u8bb0\u5f55beanName\u7684\u521d\u59cb\u5316\u72b6\u6001<\/span><\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      beforeSingletonCreation(beanName);<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      boolean newSingleton = <span class=\"code-snippet__literal\" style=\"outline: 0px;\">false<\/span>;<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      boolean recordSuppressedExceptions = (<span class=\"code-snippet__keyword\" style=\"outline: 0px;\">this<\/span>.suppressedExceptions == <span class=\"code-snippet__literal\" style=\"outline: 0px;\">null<\/span>);<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">if<\/span> (recordSuppressedExceptions) {<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">        <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">this<\/span>.suppressedExceptions = new LinkedHashSet&lt;&gt;();<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      }<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      <span class=\"code-snippet__comment\" style=\"outline: 0px;\">\/\/3\u3001\u8c03\u7528createBean\u65b9\u6cd5\u5b9e\u4f8b\u5316bean<\/span><\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      singletonObject = singletonFactory.getObject();<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      newSingleton = <span class=\"code-snippet__literal\" style=\"outline: 0px;\">true<\/span>;<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">if<\/span> (recordSuppressedExceptions) {<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">        <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">this<\/span>.suppressedExceptions = <span class=\"code-snippet__literal\" style=\"outline: 0px;\">null<\/span>;<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      }<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      <span class=\"code-snippet__comment\" style=\"outline: 0px;\">\/\/4\u3001\u521d\u59cb\u5316\u540e\u7684\u64cd\u4f5c\uff0c\u79fb\u9664\u521d\u59cb\u5316\u72b6\u6001<\/span><\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      afterSingletonCreation(beanName);<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">if<\/span> (newSingleton) {<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">        <span class=\"code-snippet__comment\" style=\"outline: 0px;\">\/\/5\u3001\u52a0\u5165\u7f13\u5b58<\/span><\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">        addSingleton(beanName, singletonObject);<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      }<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">    }<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">    <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">return<\/span> singletonObject;<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">  }<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">}<\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u8fd9\u4e00\u6b65\u7684\u6d41\u7a0b\u5c31\u662f\uff1a<\/span><\/p>\n<blockquote style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-top: 0px; padding-right: 15px; padding-left: 15px; outline: 0px; border-left-width: 4px; border-left-color: #dfe2e5; color: #777777; font-size: 16px; text-wrap: wrap; background-color: #ffffff; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; letter-spacing: normal; text-align: start;\">\n<ul class=\"list-paddingleft-1\" style=\"padding-left: 30px; outline: 0px;\" data-mark=\"-\">\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff081\uff09\u518d\u6b21\u68c0\u67e5\u7f13\u5b58\u662f\u5426\u5df2\u7ecf\u52a0\u8f7d\u8fc7<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff082\uff09\u6ca1\u6709\u52a0\u8f7d\uff0c\u5219\u8bb0\u5f55beanName \u7684\u52a0\u8f7d\u72b6\u6001<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff083\uff09\u8c03\u7528createBean()\u65b9\u6cd5\u5b9e\u4f8b\u5316 bean<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff084\uff09bean\u5b9e\u4f8b\u5316\u5b8c\u6210\u4e4b\u540e\uff0c\u79fb\u9664\u521d\u59cb\u5316\u72b6\u6001<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff085\uff09\u5c06\u5b9e\u4f8b\u5316\u7ed3\u679c\u8bb0\u5f55\u5230\u7f13\u5b58\u5e76\u5220\u9664\u52a0\u8f7d bean \u8fc7\u7a0b\u4e2d\u6240\u8bb0\u5f55\u5230\u7684\u5404\u79cd\u8f85\u52a9\u72b6\u6001<\/span><\/p>\n<\/li>\n<\/ul>\n<\/blockquote>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u5bf9\u4e8e\u7b2c(2)\u6b65\u548c\u7b2c(4)\u6b65\uff0c\u7528\u6765\u8bb0\u5f55 bean \u7684\u52a0\u8f7d\u72b6\u6001\uff0c\u662f\u7528\u6765\u5bf9 \u5faa\u73af\u4f9d\u8d56 \u8fdb\u884c\u68c0\u6d4b\u7684\u3002\u5173\u952e\u7684\u65b9\u6cd5\u5728\u4e8e\u7b2c\u4e09\u6b65\uff0c\u8c03\u7528\u4e86 ObjectFactory \u7684 getObject() \u65b9\u6cd5\uff0c\u5b9e\u9645\u56de\u8c03\u63a5\u53e3\u5b9e\u73b0\u7684\u662f createBean() \u65b9\u6cd5\u8fdb\u884c\u521b\u5efa\u5bf9\u8c61\u3002<\/span><\/p>\n<h2 style=\"margin-top: 1rem; margin-bottom: 1rem; outline: 0px; font-weight: bold; font-size: 1.75em; background-color: #ffffff; white-space: pre-wrap; break-after: avoid-page; break-inside: avoid; orphans: 4; line-height: 1.225; cursor: text; border-bottom: 1px solid #eeeeee; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u4e09\u3001Bean\u7684\u5b9e\u4f8b\u5316\u9636\u6bb5\uff1a<\/span><\/h2>\n<h3 style=\"margin-top: 1rem; margin-bottom: 1rem; outline: 0px; font-weight: bold; font-size: 1.5em; background-color: #ffffff; white-space: pre-wrap; break-after: avoid-page; break-inside: avoid; orphans: 4; line-height: 1.43; cursor: text; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\uff08\u4e00\uff09\u521b\u5efabean\u524d\u7684\u51c6\u5907\uff1a<\/span><\/h3>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"typescript\">protected Object createBean(String beanName, RootBeanDefinition mbd, @Nullable Object[] args) {RootBeanDefinition mbdToUse = mbd;\/\/ \u786e\u4fdd\u6b64\u65f6bean\u7c7b\u5df2\u7ecf\u88ab\u89e3\u6790\uff0c\u5e76\u4e14\u514b\u9686 bean \u5b9a\u4e49\uff0c\u4ee5\u9632\u52a8\u6001\u89e3\u6790\u7684\u7c7b\u4e0d\u80fd\u5b58\u50a8\u5728\u5171\u4eab\u5408\u5e76 bean \u5b9a\u4e49\u4e2d\u3002\/\/1\u3001\u9501\u5b9a class\uff0c\u6839\u636e\u8bbe\u7f6e\u7684 class \u5c5e\u6027\u6216\u8005\u6839\u636e className \u6765\u89e3\u6790 ClassClass&lt;?&gt; resolvedClass = resolveBeanClass(mbd, beanName);if (resolvedClass != null &amp;&amp; !mbd.hasBeanClass() &amp;&amp; mbd.getBeanClassName() != null) {mbdToUse = new RootBeanDefinition(mbd);mbdToUse.setBeanClass(resolvedClass);}\/\/ Prepare method overrides.\/\/2\u3001\u9a8c\u8bc1\u53ca\u51c6\u5907\u8986\u76d6\u7684\u65b9\u6cd5    mbdToUse.prepareMethodOverrides();    \/\/3\u3001\u89e3\u6790\u6307\u5b9abean\uff0c\u8ba9 beanPostProcessor \u6709\u673a\u4f1a\u8fd4\u56de\u4ee3\u7406\u800c\u4e0d\u662f\u76ee\u6807bean\u5b9e\u4f8b\u3002    Object bean = resolveBeforeInstantiation(beanName, mbdToUse);    if (bean != null) {      \/\/ \u77ed\u8def\u64cd\u4f5c\uff0c\u5982\u679c\u4ee3\u7406\u6210\u529f\u521b\u5efa bean \u540e\uff0c\u76f4\u63a5\u8fd4\u56de      return bean;    }\n\/\/4\u3001\u521b\u5efa beanObject beanInstance = doCreateBean(beanName, mbdToUse, args);return beanInstance;}<\/pre>\n<\/section>\n<p style=\"outline: 0px; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; text-wrap: wrap; background-color: #ffffff; text-align: left;\"><span style=\"outline: 0px; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; orphans: 4; text-align: start;\">\u5148\u6765\u603b\u7ed3\u8fd9\u4e2a\u6d41\u7a0b\uff1a<\/span><\/p>\n<blockquote style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-top: 0px; padding-right: 15px; padding-left: 15px; outline: 0px; border-left-width: 4px; border-left-color: #dfe2e5; color: #777777; font-size: 16px; text-wrap: wrap; background-color: #ffffff; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; letter-spacing: normal; text-align: start;\">\n<ul class=\"list-paddingleft-1\" style=\"padding-left: 30px; outline: 0px;\" data-mark=\"-\">\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff081\uff09\u6839\u636e\u8bbe\u7f6e\u7684 class \u5c5e\u6027\u6216\u8005\u6839\u636e className \u6765\u89e3\u6790 Class<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff082\uff09\u9a8c\u8bc1\u53ca\u51c6\u5907\u8986\u76d6\u7684\u65b9\u6cd5 \u8fd9\u4e2a\u65b9\u6cd5\u662f\u7528\u6765\u5904\u7406\u4ee5\u4e0b\u4e24\u4e2a\u914d\u7f6e\u7684\uff1a\u6211\u4eec\u5728\u89e3\u6790\u9ed8\u8ba4\u6807\u7b7e\u65f6\uff0c\u4f1a\u8bc6\u522b lookup-method \u548c replaced-method \u5c5e\u6027\uff0c\u7136\u540e\u8fd9\u4e24\u4e2a\u914d\u7f6e\u7684\u52a0\u8f7d\u5c06\u4f1a\u7edf\u4e00\u5b58\u653e\u5728 beanDefinition \u4e2d\u7684 methodOverrides \u5c5e\u6027\u91cc\u3002<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff083\uff09\u5e94\u7528\u521d\u59cb\u5316\u524d\u7684\u540e\u5904\u7406\u5668\uff0c\u89e3\u6790\u6307\u5b9a bean \u662f\u5426\u5b58\u5728\u521d\u59cb\u5316\u524d\u7684\u77ed\u8def\u64cd\u4f5c<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff084\uff09\u521b\u5efa bean<\/span><\/p>\n<\/li>\n<\/ul>\n<\/blockquote>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">1\u3001\u5904\u7406 Override \u5c5e\u6027\uff1a<\/strong><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"java\"><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\"><span class=\"code-snippet__function\" style=\"outline: 0px;\"><span class=\"code-snippet__keyword\" style=\"outline: 0px;\">public<\/span> <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">void<\/span> <span class=\"code-snippet__title\" style=\"outline: 0px;\">prepareMethodOverrides<\/span><span class=\"code-snippet__params\" style=\"outline: 0px;\">()<\/span> <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">throws<\/span> BeanDefinitionValidationException <\/span>{<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">  <span class=\"code-snippet__comment\" style=\"outline: 0px;\">\/\/ Check that lookup methods exists.<\/span><\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">  <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">if<\/span> (hasMethodOverrides()) {<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">    Set&lt;MethodOverride&gt; overrides = getMethodOverrides().getOverrides();<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">    <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">synchronized<\/span> (overrides) {<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">for<\/span> (MethodOverride mo : overrides) {<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">        <span class=\"code-snippet__comment\" style=\"outline: 0px;\">\/\/ \u5904\u7406 override \u5c5e\u6027<\/span><\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">        prepareMethodOverride(mo);<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      }<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">    }<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">  }<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">}<\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u53ef\u4ee5\u770b\u5230\uff0c\u83b7\u53d6\u7c7b\u7684\u91cd\u8f7d\u65b9\u6cd5\u5217\u8868\uff0c\u7136\u540e\u904d\u5386\uff0c\u4e00\u4e2a\u4e00\u4e2a\u8fdb\u884c\u5904\u7406\u3002\u5177\u4f53\u5904\u7406\u7684\u662f lookup-method \u548c replaced-method \u5c5e\u6027\uff0c\u8fd9\u4e2a\u6b65\u9aa4\u89e3\u6790\u7684\u914d\u7f6e\u5c06\u4f1a\u5b58\u5165 beanDefinition \u4e2d\u7684 methodOverrides \u5c5e\u6027\u91cc\uff0c\u662f\u4e3a\u4e86\u5f85\u4f1a\u5b9e\u4f8b\u5316\u505a\u51c6\u5907\u3002\u5982\u679c bean \u5728\u5b9e\u4f8b\u5316\u65f6\uff0c\u76d1\u6d4b\u5230 methodOverrides \u5c5e\u6027\uff0c\u4f1a\u52a8\u6001\u5730\u4f4d\u5f53\u524d bean \u751f\u6210\u4ee3\u7406\uff0c\u4f7f\u7528\u5bf9\u5e94\u7684\u62e6\u622a\u5668\u4e3a bean \u505a\u589e\u5f3a\u5904\u7406\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">2\u3001\u5b9e\u4f8b\u5316\u524d\u7684\u524d\u7f6e\u5904\u7406\uff1a<\/strong><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"typescript\"><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\"><span class=\"code-snippet__comment\" style=\"outline: 0px;\">\/\/ \u8ba9 beanPostProcessor \u6709\u673a\u4f1a\u8fd4\u56de\u4ee3\u7406\u800c\u4e0d\u662f\u76ee\u6807bean\u5b9e\u4f8b\u3002<\/span><\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\"><span class=\"code-snippet__built_in\" style=\"outline: 0px;\">Object<\/span> bean = resolveBeforeInstantiation(beanName, mbdToUse);<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\"><span class=\"code-snippet__keyword\" style=\"outline: 0px;\">if<\/span> (bean != <span class=\"code-snippet__literal\" style=\"outline: 0px;\">null<\/span>) {<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">  <span class=\"code-snippet__comment\" style=\"outline: 0px;\">\/\/ \u77ed\u8def\u64cd\u4f5c\uff0c\u5982\u679c\u4ee3\u7406\u6210\u529f\u521b\u5efa bean \u540e\uff0c\u76f4\u63a5\u8fd4\u56de<\/span><\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">  <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">return<\/span> bean;<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">}<\/span><\/code><code style=\"outline: 0px;\"> <\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\"><span class=\"code-snippet__keyword\" style=\"outline: 0px;\">protected<\/span> <span class=\"code-snippet__built_in\" style=\"outline: 0px;\">Object<\/span> resolveBeforeInstantiation(<span class=\"code-snippet__built_in\" style=\"outline: 0px;\">String<\/span> beanName, RootBeanDefinition mbd) {<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">  <span class=\"code-snippet__built_in\" style=\"outline: 0px;\">Object<\/span> bean = <span class=\"code-snippet__literal\" style=\"outline: 0px;\">null<\/span>;<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">  <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">if<\/span> (!<span class=\"code-snippet__built_in\" style=\"outline: 0px;\">Boolean<\/span>.FALSE.equals(mbd.beforeInstantiationResolved)) {<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">    <span class=\"code-snippet__comment\" style=\"outline: 0px;\">\/\/ Make sure bean class is actually resolved at this point.<\/span><\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">    <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">if<\/span> (!mbd.isSynthetic() &amp;&amp; hasInstantiationAwareBeanPostProcessors()) {<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      Class&lt;?&gt; targetType = determineTargetType(beanName, mbd);<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">if<\/span> (targetType != <span class=\"code-snippet__literal\" style=\"outline: 0px;\">null<\/span>) {<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">          <span class=\"code-snippet__comment\" style=\"outline: 0px;\">\/\/ \u6267\u884c\u524d\u7f6e\u62e6\u622a\u5668\u7684\u64cd\u4f5c<\/span><\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">        bean = applyBeanPostProcessorsBeforeInstantiation(targetType, beanName);<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">        <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">if<\/span> (bean != <span class=\"code-snippet__literal\" style=\"outline: 0px;\">null<\/span>) {<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">            <span class=\"code-snippet__comment\" style=\"outline: 0px;\">\/\/ \u6267\u884c\u540e\u7f6e\u62e6\u622a\u5668\u7684\u64cd\u4f5c<\/span><\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">          bean = applyBeanPostProcessorsAfterInitialization(bean, beanName);<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">        }<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">      }<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">    }<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">    mbd.beforeInstantiationResolved = (bean != <span class=\"code-snippet__literal\" style=\"outline: 0px;\">null<\/span>);<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">  }<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">  <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">return<\/span> bean;<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">}<\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u5728 doCreateBean() \u65b9\u6cd5\u524d\uff0c\u6709\u4e00\u4e2a\u77ed\u8def\u64cd\u4f5c\uff0c\u5982\u679c\u540e\u5904\u7406\u5668\u6210\u529f\uff0c\u5c06\u4f1a\u8fd4\u56de\u4ee3\u7406\u7684 bean\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u5728 resolveBeforeInstantiation() \u65b9\u6cd5\u4e2d\uff0c\u5728\u786e\u4fdd bean \u4fe1\u606f\u5df2\u7ecf\u88ab\u89e3\u6790\u5b8c\u6210\uff0c\u6267\u884c\u4e86\u4e24\u4e2a\u5173\u952e\u65b9\u6cd5\uff0c\u4ece\u6ce8\u91ca\u4e2d\u770b\u5230\uff0c\u4e00\u4e2a\u662f\u524d\u7f6e\u62e6\u622a\u5668\u7684\u64cd\u4f5c\uff0c\u53e6\u4e00\u4e2a\u5c31\u662f\u540e\u7f6e\u62e6\u622a\u5668\u7684\u64cd\u4f5c\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u5982\u679c\u7b2c\u4e00\u4e2a\u524d\u7f6e\u62e6\u622a\u5668\u5b9e\u4f8b\u5316\u6210\u529f\uff0c\u5c31\u5df2\u7ecf\u5c06\u5355\u4f8b bean \u653e\u5165\u7f13\u5b58\u4e2d\uff0c\u5b83\u4e0d\u4f1a\u518d\u7ecf\u5386\u666e\u901a bean \u7684\u521b\u5efa\u8fc7\u7a0b\uff0c\u6ca1\u6709\u673a\u4f1a\u8fdb\u884c\u540e\u5904\u7406\u5668\u7684\u8c03\u7528\uff0c\u6240\u4ee5\u5728\u8fd9\u91cc\u7684\u7b2c\u4e8c\u4e2a\u6b65\u9aa4\uff0c\u5c31\u662f\u4e3a\u4e86\u8fd9\u4e2a bean \u4e5f\u80fd\u5e94\u7528\u540e\u5904\u7406\u5668\u7684 postProcessAfterInitialization \u65b9\u6cd5\u3002\u800c\u5982\u679c\u8fd9\u4e2abean\u6ca1\u6709\u7279\u5b9a\u7684\u524d\u7f6e\u5904\u7406\uff0c\u90a3\u8bf4\u660e\u8fd9\u4e2abean\u662f\u4e00\u4e2a\u666e\u901a\u7684bean\uff0c\u5219\u6309\u7167\u4e0b\u9762\u7684\u6b65\u9aa4\u8fdb\u884c\u521b\u5efa<\/span><\/p>\n<h3 style=\"margin-top: 1rem; margin-bottom: 1rem; outline: 0px; font-weight: bold; font-size: 1.5em; background-color: #ffffff; white-space: pre-wrap; break-after: avoid-page; break-inside: avoid; orphans: 4; line-height: 1.43; cursor: text; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\uff08\u4e8c\uff09bean\u7684\u521b\u5efa\uff1adoCreateBean()<\/span><\/h3>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u5230\u4e86\u8fd9\u4e00\u6b65\uff0c\u5c31\u5f00\u59cb\u771f\u6b63\u521b\u5efabean\u5bf9\u8c61\u4e86\uff0c\u5bf9\u5e94\u7684\u6e90\u7801\u5c31\u5728doCreateBean()\u65b9\u6cd5\u4e2d\uff0c\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u5148\u770b\u4e00\u4e0bbean\u7684\u6574\u4f53\u521b\u5efa\u6d41\u7a0b\u662f\u600e\u4e48\u6837\u7684\uff0c\u7136\u540e\u518d\u5bf9\u5176\u4e2d\u7684\u5404\u4e2a\u91cd\u8981\u7684\u65b9\u6cd5\u4f5c\u5206\u6790\uff1a<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"typescript\">protected Object doCreateBean(final String beanName, final RootBeanDefinition mbd, final @Nullable Object[] args) {  \/\/ Instantiate the bean.  BeanWrapper instanceWrapper = null;    \/\/1\u3001\u5982\u679cbean\u662f\u5355\u4f8b\uff0c\u5c31\u5148\u6e05\u9664\u7f13\u5b58\u4e2d\u7684bean\u4fe1\u606f  if (mbd.isSingleton()) {    instanceWrapper = this.factoryBeanInstanceCache.remove(beanName);  }  if (instanceWrapper == null) {    \/\/2\u3001\u6839\u636e\u6307\u5b9abean\u4f7f\u7528\u5bf9\u5e94\u7684\u7b56\u7565\u5b9e\u4f8b\u5316bean\uff0c\u4f8b\u5982\uff1a\u5de5\u5382\u65b9\u6cd5\uff0c\u6784\u9020\u51fd\u6570\u81ea\u52a8\u6ce8\u5165\uff0c\u7b80\u5355\u521d\u59cb\u5316    instanceWrapper = createBeanInstance(beanName, mbd, args);  }  final Object bean = instanceWrapper.getWrappedInstance();  Class&lt;?&gt; beanType = instanceWrapper.getWrappedClass();  if (beanType != NullBean.class) {    mbd.resolvedTargetType = beanType;  }  \/\/3\u3001\u5141\u8bb8\u540e\u5904\u7406\u5904\u7406\u5668\u4fee\u6539\u5408\u5e76\u540e\u7684bean\u5b9a\u4e49  synchronized (mbd.postProcessingLock) {    if (!mbd.postProcessed) {      applyMergedBeanDefinitionPostProcessors(mbd, beanType, beanName);      mbd.postProcessed = true;    }  }  \/\/4\u3001\u662f\u5426\u9700\u8981\u63d0\u524d\u66dd\u5149\uff0c\u7528\u6765\u89e3\u51b3\u5faa\u73af\u4f9d\u8d56\u65f6\u4f7f\u7528  boolean earlySingletonExposure = (mbd.isSingleton() &amp;&amp; this.allowCircularReferences &amp;&amp;      isSingletonCurrentlyInCreation(beanName));  if (earlySingletonExposure) {    \/\/ \u7b2c\u4e8c\u4e2a\u53c2\u6570\u662f\u56de\u8c03\u63a5\u53e3\uff0c\u5b9e\u73b0\u7684\u529f\u80fd\u662f\u5c06\u5207\u9762\u52a8\u6001\u7ec7\u5165 bean    addSingletonFactory(beanName, () -&gt; getEarlyBeanReference(beanName, mbd, bean));  }  Object exposedObject = bean;    \/\/5\u3001\u5bf9 bean \u8fdb\u884c\u586b\u5145\uff0c\u5c06\u5404\u4e2a\u5c5e\u6027\u503c\u6ce8\u5165    \/\/ \u5982\u679c\u5b58\u5728\u5bf9\u5176\u5b83 bean \u7684\u4f9d\u8d56\uff0c\u5c06\u4f1a\u9012\u5f52\u521d\u59cb\u5316\u4f9d\u8d56\u7684 bean    populateBean(beanName, mbd, instanceWrapper);    \/\/6\u3001\u8c03\u7528\u521d\u59cb\u5316\u65b9\u6cd5\uff0c\u4f8b\u5982 init-method    exposedObject = initializeBean(beanName, exposedObject, mbd);      \/\/7\u3001\u5faa\u73af\u4f9d\u8d56\u68c0\u67e5  if (earlySingletonExposure) {    Object earlySingletonReference = getSingleton(beanName, false);    \/\/ earlySingletonReference \u53ea\u6709\u5728\u68c0\u6d4b\u5230\u6709\u5faa\u73af\u4f9d\u8d56\u7684\u60c5\u51b5\u4e0b\u624d \u4e0d\u4e3a\u7a7a    if (earlySingletonReference != null) {      if (exposedObject == bean) {        \/\/ \u5982\u679c exposedObject \u6ca1\u6709\u5728\u521d\u59cb\u5316\u65b9\u6cd5\u4e2d\u88ab\u6539\u53d8\uff0c\u4e5f\u5c31\u662f\u6ca1\u6709\u88ab\u589e\u5f3a        exposedObject = earlySingletonReference;      }      else if (!this.allowRawInjectionDespiteWrapping &amp;&amp; hasDependentBean(beanName)) {        String[] dependentBeans = getDependentBeans(beanName);        Set&lt;String&gt; actualDependentBeans = new LinkedHashSet&lt;&gt;(dependentBeans.length);        for (String dependentBean : dependentBeans) {          \/\/ \u68c0\u67e5\u4f9d\u8d56          if (!removeSingletonIfCreatedForTypeCheckOnly(dependentBean)) {            actualDependentBeans.add(dependentBean);          }        }        \/\/ bean \u521b\u5efa\u540e\uff0c\u5b83\u6240\u4f9d\u8d56\u7684 bean \u4e00\u5b9a\u662f\u5df2\u7ecf\u521b\u5efa\u4e86        \/\/ \u5728\u4e0a\u9762\u5df2\u7ecf\u627e\u5230\u5b83\u6709\u4f9d\u8d56\u7684 bean\uff0c\u5982\u679c actualDependentBeans \u4e0d\u4e3a\u7a7a        \/\/ \u8868\u793a\u8fd8\u6709\u4f9d\u8d56\u7684 bean \u6ca1\u6709\u521d\u59cb\u5316\u5b8c\u6210\uff0c\u4e5f\u5c31\u662f\u5b58\u5728\u5faa\u73af\u4f9d\u8d56        if (!actualDependentBeans.isEmpty()) {          throw new BeanCurrentlyInCreationException(beanName);      }    }  }  \/\/ Register bean as disposable.  \/\/ 8\u3001\u6839\u636e scope \u6ce8\u518c bean  registerDisposableBeanIfNecessary(beanName, bean, mbd);  return exposedObject;}<\/pre>\n<\/section>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u8fd9\u4e2adoCreateBean()\u65b9\u6cd5\u7684\u4e3b\u8981\u6d41\u7a0b\u53ef\u4ee5\u603b\u7ed3\u4e3a\uff1a<\/span><\/p>\n<blockquote style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-top: 0px; padding-right: 15px; padding-left: 15px; outline: 0px; border-left-width: 4px; border-left-color: #dfe2e5; color: #777777; font-size: 16px; text-wrap: wrap; background-color: #ffffff; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; letter-spacing: normal; text-align: start;\">\n<ul class=\"list-paddingleft-1\" style=\"padding-left: 30px; outline: 0px;\" data-mark=\"-\">\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff081\uff09\u5982\u679c\u8981\u52a0\u8f7d\u7684bean\u662f\u5355\u4f8b\uff0c\u5c31\u5148\u6e05\u9664\u7f13\u5b58\u4e2d\u7684bean\u4fe1\u606f<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff082\uff09\u5b9e\u4f8b\u5316 bean\uff0c\u5c06 BeanDifinition \u8f6c\u5316\u6210 BeanWrapper<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff083\uff09\u540e\u7f6e\u5904\u7406\u5668\u4fee\u6539\u5408\u5e76\u540e\u7684 bean \u5b9a\u4e49\uff1abean \u5408\u5e76\u540e\u7684\u5904\u7406\uff0cAutowired \u6ce8\u89e3\u6b63\u5f0f\u901a\u8fc7\u6b64\u65b9\u6cd5\u5b9e\u73b0\u8bf8\u5982\u7c7b\u578b\u7684\u9884\u89e3\u6790<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff084\uff09\u4f9d\u8d56\u5904\u7406\uff0c\u63d0\u524d\u66b4\u9732bean\u7684\u5f15\u7528\uff0c\u4e3b\u8981\u7528\u4e8e\u89e3\u51b3\u5faa\u73af\u4f9d\u8d56\u7684\u95ee\u9898<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff085\uff09\u5c5e\u6027\u586b\u5145\uff1a\u5c06\u6240\u6709\u5c5e\u6027\u586b\u5145\u5230 bean \u7684\u5b9e\u4f8b\u4e2d\uff0c\u5982\u679c\u5b58\u5728\u5bf9\u5176\u4ed6bean\u7684\u4f9d\u8d56\uff0c\u5c06\u4f1a\u9012\u5f52\u521d\u59cb\u5316\u4f9d\u8d56\u7684bean<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff086\uff09\u521d\u59cb\u5316bean\uff1a\u4f8b\u5982afeterPropertiesSet()\u548cinit-method\u5c5e\u6027\u914d\u7f6e\u7684\u65b9\u6cd5<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff087\uff09\u5faa\u73af\u4f9d\u8d56\u68c0\u67e5<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff088\uff09\u6ce8\u518c DisposableBean\uff1a\u8fd9\u4e00\u6b65\u662f\u7528\u6765\u5904\u7406 destroy-method \u5c5e\u6027\uff0c\u5728\u8fd9\u4e00\u6b65\u6ce8\u518c\uff0c\u4ee5\u4fbf\u5728\u9500\u6bc1\u5bf9\u8c61\u65f6\u8c03\u7528\u3002<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff089\uff09\u5b8c\u6210\u521b\u5efa\u5e76\u8fd4\u56de\u3002<\/span><\/p>\n<\/li>\n<\/ul>\n<\/blockquote>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">1\u3001createBeanInstance()\uff1a\u5b9e\u4f8b\u5316bean\u5bf9\u8c61<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u5728\u4e0a\u9762\u7b2c(2)\u4e2a\u6b65\u9aa4\uff0c\u505a\u7684\u662f\u5b9e\u4f8b\u5316bean\uff0c\u7136\u540e\u8fd4\u56deBeanWrapper\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">createBeanInstance()\u8fd9\u4e00\u6b65\u7684\u6d41\u7a0b\u4e3b\u8981\u901a\u8fc7\u4e24\u79cd\u65b9\u5f0f\u5b9e\u4f8b\u5316bean\u5bf9\u8c61\uff0c\u4e00\u79cd\u662f\u5de5\u5382\u65b9\u6cd5\uff0c\u53e6\u4e00\u79cd\u5c31\u662f\u6784\u9020\u51fd\u6570\uff0c\u5c06\u4f20\u8fdb\u6765\u7684 RootBeanDefinition \u4e2d\u7684\u914d\u7f6e\u4e8c\u9009\u4e00\u751f\u6210 bean \u5b9e\u4f8b\uff0c\u5927\u81f4\u4ecb\u7ecd\u529f\u80fd\uff1a<\/span><\/p>\n<blockquote style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-top: 0px; padding-right: 15px; padding-left: 15px; outline: 0px; border-left-width: 4px; border-left-color: #dfe2e5; color: #777777; font-size: 16px; text-wrap: wrap; background-color: #ffffff; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; letter-spacing: normal; text-align: start;\">\n<ul class=\"list-paddingleft-1\" style=\"padding-left: 30px; outline: 0px;\" data-mark=\"-\">\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\u5982\u679c\u5b58\u5728\u5de5\u5382\u65b9\u6cd5\u5219\u4f7f\u7528\u5de5\u5382\u65b9\u6cd5\u8fdb\u884c\u521d\u59cb\u5316<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\u5982\u679c\u5219\u4f7f\u7528\u6709\u53c2\u6784\u9020\u884c\u6570\u5b9e\u4f8b\u5316bean\uff1a\u4e00\u4e2a\u7c7b\u6709\u591a\u4e2a\u6784\u9020\u51fd\u6570\uff0c\u6bcf\u4e2a\u6784\u9020\u51fd\u6570\u90fd\u6709\u4e0d\u540c\u7684\u53c2\u6570\uff0c\u6240\u4ee5\u9700\u8981\u6839\u636e\u53c2\u6570\u9501\u5b9a\u6784\u9020\u51fd\u6570\u8fdb\u884c bean \u7684\u5b9e\u4f8b\u5316<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\u5982\u679c\u65e2\u4e0d\u5b58\u5728\u5de5\u5382\u65b9\u6cd5\uff0c\u4e5f\u4e0d\u5b58\u5728\u5e26\u6709\u53c2\u6570\u7684\u6784\u9020\u51fd\u6570\uff0c\u4f1a\u4f7f\u7528\u9ed8\u8ba4\u7684\u6784\u9020\u51fd\u6570\u8fdb\u884c bean \u7684\u5b9e\u4f8b\u5316<\/span><\/p>\n<\/li>\n<\/ul>\n<\/blockquote>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre data-lang=\"kotlin\">protected BeanWrapper createBeanInstance(String beanName, RootBeanDefinition mbd, Object[] args) {  \/\/ Make sure bean class is actually resolved at this point.  Class&lt;?&gt; beanClass = resolveBeanClass(mbd, beanName);  Supplier&lt;?&gt; instanceSupplier = mbd.getInstanceSupplier();  \/\/ Shortcut when re-creating the same bean...  boolean resolved = false;  boolean autowireNecessary = false;  if (args == null) {    synchronized (mbd.constructorArgumentLock) {      \/\/ \u5982\u679c\u4e00\u4e2a\u7c7b\u6709\u591a\u4e2a\u6784\u9020\u51fd\u6570\uff0c\u6bcf\u4e2a\u6784\u9020\u51fd\u6570\u90fd\u6709\u4e0d\u540c\u7684\u53c2\u6570\uff0c\u8c03\u7528\u524d\u9700\u8981\u8fdb\u884c\u5224\u65ad\u5bf9\u5e94\u7684\u6784\u9020\u51fd\u6570\u6216\u8005\u5de5\u5382\u65b9\u6cd5      if (mbd.resolvedConstructorOrFactoryMethod != null) {        resolved = true;        autowireNecessary = mbd.constructorArgumentsResolved;      }    }  }  \/\/ \u5982\u679c\u5df2\u7ecf\u89e3\u6790\u8fc7\uff0c\u4e0d\u9700\u8981\u518d\u6b21\u89e3\u6790  if (resolved) {    if (autowireNecessary) {      \/\/ \u5b9e\u9645\u89e3\u6790\u7684\u662f org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor      \/\/ \u6784\u9020\u51fd\u6570\u81ea\u52a8\u6ce8\u5165      return autowireConstructor(beanName, mbd, null, null);    }    else {      \/\/ \u4f7f\u7528\u9ed8\u8ba4\u7684\u6784\u9020\u51fd\u6570      return instantiateBean(beanName, mbd);    }  }    \/\/ Candidate constructors for autowiring? \u9700\u8981\u6839\u636e\u53c2\u6570\u89e3\u6790\u6784\u9020\u51fd\u6570  Constructor&lt;?&gt;[] ctors = determineConstructorsFromBeanPostProcessors(beanClass, beanName);  if (ctors != null || mbd.getResolvedAutowireMode() == AUTOWIRE_CONSTRUCTOR ||      mbd.hasConstructorArgumentValues() || !ObjectUtils.isEmpty(args)) {    return autowireConstructor(beanName, mbd, ctors, args);  }  \/\/ Preferred constructors for default construction?  ctors = mbd.getPreferredConstructors();  if (ctors != null) {    \/\/ \u6784\u9020\u51fd\u6570\u6ce8\u5165    return autowireConstructor(beanName, mbd, ctors, null);  }  \/\/ No special handling: simply use no-arg constructor. \u6ca1\u6709\u7279\u6b8a\u7684\u5904\u7406\uff0c\u4f7f\u7528\u9ed8\u8ba4\u6784\u9020\u51fd\u6570\u6784\u9020  return instantiateBean(beanName, mbd);}<\/pre>\n<\/section>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u7b80\u5355\u4ecb\u7ecd\u4e0b\u4ec0\u4e48\u662fBeanWrapper\uff1a<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">Spring\u4e2d\u7684Bean\u5e76\u4e0d\u662f\u4ee5\u4e00\u4e2a\u4e2a\u7684\u672c\u6765\u6a21\u6837\u5b58\u5728\u7684\uff0c\u7531\u4e8eSpring IOC\u5bb9\u5668\u4e2d\u8981\u7ba1\u7406\u591a\u79cd\u7c7b\u578b\u7684\u5bf9\u8c61\uff0c\u56e0\u6b64\u4e3a\u4e86\u7edf\u4e00\u5bf9\u4e0d\u540c\u7c7b\u578b\u5bf9\u8c61\u7684\u8bbf\u95ee\uff0cSpring\u7ed9\u6240\u6709\u521b\u5efa\u7684Bean\u5b9e\u4f8b\u7a7f\u4e0a\u4e86\u4e00\u5c42\u5916\u5957\uff0c\u8fd9\u4e2a\u5916\u5957\u5c31\u662fBeanWrapper\uff0cBeanWrapper\u5b9e\u9645\u4e0a\u662f\u5bf9\u53cd\u5c04\u76f8\u5173API\u7684\u7b80\u5355\u5c01\u88c5\uff0c\u4f7f\u5f97\u4e0a\u5c42\u4f7f\u7528\u53cd\u5c04\u5b8c\u6210\u76f8\u5173\u7684\u4e1a\u52a1\u903b\u8f91\u5927\u5927\u7684\u7b80\u5316\uff0c\u6211\u4eec\u8981\u83b7\u53d6\u67d0\u4e2a\u5bf9\u8c61\u7684\u5c5e\u6027\uff0c\u8c03\u7528\u67d0\u4e2a\u5bf9\u8c61\u7684\u65b9\u6cd5\uff0c\u73b0\u5728\u4e0d\u9700\u8981\u5728\u5199\u7e41\u6742\u7684\u53cd\u5c04API\u4e86\u4ee5\u53ca\u5904\u7406\u4e00\u5806\u9ebb\u70e6\u7684\u5f02\u5e38\uff0c\u76f4\u63a5\u901a\u8fc7BeanWrapper\u5c31\u53ef\u4ee5\u5b8c\u6210\u76f8\u5173\u64cd\u4f5c\uff0c\u7b80\u76f4\u4e0d\u8981\u592a\u723d\u4e86\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">2\u3001\u5faa\u73af\u4f9d\u8d56\uff1a<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u8fd9\u91cc\u5bf9\u5e94\u524d\u9762\u7684\u7b2c(4)\u6b65\u7684\u6d41\u7a0b\uff0c\u63d0\u524d\u66b4\u9732bean\u7684\u5f15\u7528\uff0c\u4e3b\u8981\u662f\u7528\u4e8e\u89e3\u51b3\u5faa\u73af\u4f9d\u8d56\u7684\u95ee\u9898<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"typescript\">\/\/ \u662f\u5426\u9700\u8981\u63d0\u524d\u66dd\u5149\uff0c\u7528\u6765\u89e3\u51b3\u5faa\u73af\u4f9d\u8d56\u65f6\u4f7f\u7528boolean earlySingletonExposure = (mbd.isSingleton() &amp;&amp; this.allowCircularReferences &amp;&amp;    isSingletonCurrentlyInCreation(beanName));if (earlySingletonExposure) {  \/\/ \u7b2c\u4e8c\u4e2a\u53c2\u6570\u662f\u56de\u8c03\u63a5\u53e3\uff0c\u5b9e\u73b0\u7684\u529f\u80fd\u662f\u5c06\u5207\u9762\u52a8\u6001\u7ec7\u5165 bean  addSingletonFactory(beanName, () -&gt; getEarlyBeanReference(beanName, mbd, bean));}<\/pre>\n<\/section>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u5173\u952e\u65b9\u6cd5\u662f addSingletonFactory\uff0c\u4f5c\u7528\u662f\u5728 bean \u5f00\u59cb\u521d\u59cb\u5316\u524d\u5c06\u521b\u5efa\u5b9e\u4f8b\u7684 ObjectFactory \u52a0\u5165\u5355\u4f8b\u5de5\u5382\uff0cObjectFactory \u662f\u521b\u5efa\u5bf9\u8c61\u65f6\u4f7f\u7528\u7684\u5de5\u5382\u3002\u5728\u5bf9\u8c61\u5b9e\u4f8b\u5316\u65f6\uff0c\u4f1a\u5224\u65ad\u81ea\u5df1\u4f9d\u8d56\u7684\u5bf9\u8c61\u662f\u5426\u5df2\u7ecf\u521b\u5efa\u597d\u4e86\uff0c\u5224\u65ad\u7684\u4f9d\u636e\u662f\u67e5\u770b\u4f9d\u8d56\u5bf9\u8c61\u7684 ObjectFactory \u662f\u5426\u5728\u5355\u4f8b\u7f13\u5b58\u4e2d\uff0c\u5982\u679c\u6ca1\u6709\u521b\u5efa\u5c06\u4f1a\u5148\u521b\u5efa\u4f9d\u8d56\u7684\u5bf9\u8c61\uff0c\u7136\u540e\u5c06 ObjectFactory \u653e\u5165\u5355\u4f8b\u7f13\u5b58\u4e2d\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u8fd9\u65f6\u5982\u679c\u6709\u5faa\u73af\u4f9d\u8d56\uff0c\u9700\u8981\u63d0\u524d\u5bf9\u5b83\u8fdb\u884c\u66b4\u9732\uff0c\u8ba9\u4f9d\u8d56\u65b9\u627e\u5230\u5e76\u6b63\u5e38\u5b9e\u4f8b\u5316\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u6709\u5173\u5faa\u73af\u4f9d\u8d56\u7684\u5185\u5bb9\u53ef\u4ee5\u9605\u8bfb\u8fd9\u7bc7\u6587\u7ae0\uff1a<\/span><a href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454673597&amp;idx=1&amp;sn=38da2b58ba3b2e1972372c1da36147fb&amp;chksm=b13ce6a3864b6fb5a0793347f200f785a688ad650529c4e06a9c660d67c516ea44fe2572e39c&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"outline: 0px;\">Spring\u6e90\u7801\u89e3\u6790-Spring \u5faa\u73af\u4f9d\u8d56<\/span><\/a><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">3\u3001populateBean()\uff1a\u5c5e\u6027\u6ce8\u5165<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u8fd9\u91cc\u5bf9\u5e94\u524d\u9762\u7684\u7b2c(5)\u6b65\uff0c\u6839\u636e\u4e0d\u540c\u7684\u6ce8\u5165\u7c7b\u578b\u8fdb\u884c\u5c5e\u6027\u586b\u5145\uff0c\u7136\u540e\u8c03\u7528\u540e\u5904\u7406\u5668\u8fdb\u884c\u5904\u7406\uff0c\u6700\u7ec8\u5c06\u5c5e\u6027\u5e94\u7528\u5230 bean \u4e2d\u3002\u4e3b\u8981\u6d41\u7a0b\u5982\u4e0b\uff1a<\/span><\/p>\n<blockquote style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-top: 0px; padding-right: 15px; padding-left: 15px; outline: 0px; border-left-width: 4px; border-left-color: #dfe2e5; color: #777777; font-size: 16px; text-wrap: wrap; background-color: #ffffff; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; letter-spacing: normal; text-align: start;\">\n<p style=\"margin-bottom: 0.8em; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff081\uff09\u8c03\u7528 InstantiationAwareBeanPostProcessor \u5904\u7406\u5668\u7684 postProcessAfterInstantiation \u65b9\u6cd5\uff0c\u5224\u65ad\u63a7\u5236\u7a0b\u5e8f\u662f\u5426\u7ee7\u7eed\u8fdb\u884c\u5c5e\u6027\u586b\u5145<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff082\uff09\u6839\u636e\u6ce8\u5165\u7c7b\u578b\uff08byType\/byName\uff09\uff0c\u63d0\u53d6\u4f9d\u8d56\u7684\uff0c\u7edf\u4e00\u5b58\u5165 PropertyValues \u4e2d<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff083\uff09\u5224\u65ad\u662f\u5426\u9700\u8981\u8fdb\u884c BeanPostProcessor \u548c \u4f9d\u8d56\u68c0\u67e5\uff1a<\/span><\/p>\n<ul class=\"list-paddingleft-1\" style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-left: 30px; outline: 0px;\" data-mark=\"-\">\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\u5982\u679c\u6709\u540e\u7f6e\u5904\u7406\u5668\uff0c\u5c06\u4f1a\u5e94\u7528 InstantiationAwareBeanPostProcessor \u5904\u7406\u5668\u7684 postProcessProperties \u65b9\u6cd5\uff0c\u5bf9\u5c5e\u6027\u83b7\u53d6\u5b8c\u6bd5\u586b\u5145\u524d\uff0c\u5bf9\u5c5e\u6027\u8fdb\u884c\u518d\u6b21\u5904\u7406\u3002<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\u4f7f\u7528 checkDependencies \u65b9\u6cd5\u6765\u8fdb\u884c\u4f9d\u8d56\u68c0\u67e5<\/span><\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-top: 0.8em; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\uff084\uff09\u5c06\u6240\u6709\u89e3\u6790\u5230\u7684 PropertyValues \u4e2d\u7684\u5c5e\u6027\u586b\u5145\u81f3 BeanWrapper \u4e2d<\/span><\/p>\n<\/blockquote>\n<section>\n<pre data-lang=\"typescript\">protected\u00a0void\u00a0populateBean(String\u00a0beanName,\u00a0RootBeanDefinition\u00a0mbd,\u00a0@Nullable\u00a0BeanWrapper\u00a0bw)\u00a0{\/\/ \u7ed9 awareBeanPostProcessor \u540e\u5904\u7406\u5668\u6700\u540e\u4e00\u6b21\u673a\u4f1a\uff0c\u5728\u5c5e\u6027\u8bbe\u7f6e\u4e4b\u524d\u4fee\u6539bean\u7684\u5c5e\u6027boolean continueWithPropertyPopulation = true;if (!mbd.isSynthetic() &amp;&amp; hasInstantiationAwareBeanPostProcessors()) {...        if (!ibp.postProcessAfterInstantiation(bw.getWrappedInstance(), beanName)) {continueWithPropertyPopulation = false;break;}        ...}PropertyValues pvs = (mbd.hasPropertyValues() ? mbd.getPropertyValues() : null);int resolvedAutowireMode = mbd.getResolvedAutowireMode();if (resolvedAutowireMode == AUTOWIRE_BY_NAME || resolvedAutowireMode == AUTOWIRE_BY_TYPE) {MutablePropertyValues newPvs = new MutablePropertyValues(pvs);\/\/ Add property values based on autowire by name if applicable.if (resolvedAutowireMode == AUTOWIRE_BY_NAME) {\/\/ \u6839\u636e\u540d\u5b57\u81ea\u52a8\u6ce8\u5165autowireByName(beanName, mbd, bw, newPvs);}\/\/ Add property values based on autowire by type if applicable.if (resolvedAutowireMode == AUTOWIRE_BY_TYPE) {\/\/ \u6839\u636e\u7c7b\u578b\u81ea\u52a8\u6ce8\u5165autowireByType(beanName, mbd, bw, newPvs);}pvs = newPvs;}\/\/ \u540e\u5904\u7406\u5668\u5df2\u7ecf\u521d\u59cb\u5316boolean hasInstAwareBpps = hasInstantiationAwareBeanPostProcessors();\/\/ \u9700\u8981\u4f9d\u8d56\u68c0\u67e5boolean needsDepCheck = (mbd.getDependencyCheck() != AbstractBeanDefinition.DEPENDENCY_CHECK_NONE);PropertyDescriptor[] filteredPds = null;    \/\/ \u4ece beanPostProcessors \u5bf9\u8c61\u4e2d\u63d0\u53d6 BeanPostProcessor \u7ed3\u679c\u96c6\uff0c\u904d\u5386\u540e\u5904\u7406\u5668    for (BeanPostProcessor bp : getBeanPostProcessors()) {      ...    }\/\/ \u5728\u524d\u9762\u4e5f\u51fa\u73b0\u8fc7\uff0c\u7528\u6765\u8fdb\u884c\u4f9d\u8d56\u68c0\u67e5    filteredPds = filterPropertyDescriptorsForDependencyCheck(bw, mbd.allowCaching);    checkDependencies(beanName, mbd, filteredPds, pvs);\/\/ \u5c06\u5c5e\u6027\u5e94\u7528\u5230 bean \u4e2d\uff0c\u4f7f\u7528\u6df1\u62f7\u8d1d\uff0c\u5c06\u5b50\u7c7b\u7684\u5c5e\u6027\u4e00\u5e76\u62f7\u8d1dapplyPropertyValues(beanName, mbd, bw, pvs);}<\/pre>\n<\/section>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">4\u3001initializeBean()\uff1a\u521d\u59cb\u5316 bean<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u8fd9\u91cc\u5bf9\u5e94\u524d\u9762\u7684\u7b2c(6)\u6b65\uff0c\u4e3b\u8981\u662f\u7528\u6765\u8fdb\u884c\u6211\u4eec\u8bbe\u5b9a\u7684\u521d\u59cb\u5316\u65b9\u6cd5\u7684\u8c03\u7528\uff0c\u4e0d\u8fc7\u5728\u65b9\u6cd5\u5185\u90e8\uff0c\u8fd8\u505a\u4e86\u5176\u5b83\u64cd\u4f5c\uff0c\u9996\u5148\u6211\u4eec\u5148\u770b\u4e0b\u6e90\u7801\uff1a<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"typescript\">protected Object initializeBean(final String beanName, final Object bean, @Nullable RootBeanDefinition mbd) {    \/\/1\u3001\u5904\u7406Aware\u63a5\u53e3  if (System.getSecurityManager() != null) {    AccessController.doPrivileged((PrivilegedAction&lt;Object&gt;) () -&gt; {      invokeAwareMethods(beanName, bean);      return null;    }, getAccessControlContext());  }  else {    \/\/ \u5982\u679c\u6ca1\u6709 securityManage\uff0c\u65b9\u6cd5\u91cc\u9762\u6821\u9a8c\u4e86 bean \u7684\u7c7b\u578b\uff0c\u9700\u8981\u5f15\u7528 Aware \u63a5\u53e3    \/\/ \u5bf9\u7279\u6b8a\u7684 bean \u5904\u7406\uff1aAware\/ BeanClassLoader \/ BeanFactoryAware    invokeAwareMethods(beanName, bean);  }     \/\/2\u3001\u6267\u884cBeanPostProcessor\u524d\u7f6e\u5904\u7406\uff1a  Object wrappedBean = bean;  if (mbd == null || !mbd.isSynthetic()) {    wrappedBean = applyBeanPostProcessorsBeforeInitialization(wrappedBean, beanName);  }  \/\/3\u3001\u8c03\u7528\u7528\u6237\u81ea\u5b9a\u4e49\u7684 init-method \u65b9\u6cd5  invokeInitMethods(beanName, wrappedBean, mbd);     \/\/4\u3001\u6267\u884cBeanPostProcessor\u540e\u7f6e\u5904\u7406  if (mbd == null || !mbd.isSynthetic()) {    wrappedBean = applyBeanPostProcessorsAfterInitialization(wrappedBean, beanName); <code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\"> }<\/span><\/code><code style=\"outline: 0px;\"> <\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">  <span class=\"code-snippet__keyword\" style=\"outline: 0px;\">return<\/span> wrappedBean;<\/span><\/code><code style=\"outline: 0px;\"><span class=\"code-snippet_outer\" style=\"outline: 0px;\">}<\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u8fd9\u4e00\u6b65\u7684\u6d41\u7a0b\u4e2d\uff0c\u4e3b\u8981\u505a\u7684\u5904\u7406\u64cd\u4f5c\u6709\uff1a<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">\uff081\uff09\u5904\u7406Aware\u63a5\u53e3\uff1a<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">Spring\u4f1a\u68c0\u6d4b\u8be5\u5bf9\u8c61\u662f\u5426\u5b9e\u73b0\u4e86xxxAware\u63a5\u53e3\uff0c\u901a\u8fc7Aware\u7c7b\u578b\u7684\u63a5\u53e3\uff0c\u53ef\u4ee5\u8ba9\u6211\u4eec\u62ff\u5230Spring\u5bb9\u5668\u7684\u4e00\u4e9b\u76f8\u5e94\u7684\u8d44\u6e90\u5e76\u6ce8\u5165\uff1a<\/span><\/p>\n<blockquote style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-top: 0px; padding-right: 15px; padding-left: 15px; outline: 0px; border-left-width: 4px; border-left-color: #dfe2e5; color: #777777; font-size: 16px; text-wrap: wrap; background-color: #ffffff; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; letter-spacing: normal; text-align: start;\">\n<ul class=\"list-paddingleft-1\" style=\"padding-left: 30px; outline: 0px;\" data-mark=\"-\">\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\u2460\u5982\u679c\u8fd9\u4e2aBean\u5b9e\u73b0\u4e86BeanNameAware\u63a5\u53e3\uff0c\u4f1a\u8c03\u7528\u5b83\u5b9e\u73b0\u7684setBeanName(String beanId)\u65b9\u6cd5\uff0c\u4f20\u5165Bean\u7684\u540d\u5b57\uff1b<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\u2461\u5982\u679c\u8fd9\u4e2aBean\u5b9e\u73b0\u4e86BeanClassLoaderAware\u63a5\u53e3\uff0c\u8c03\u7528setBeanClassLoader()\u65b9\u6cd5\uff0c\u4f20\u5165ClassLoader\u5bf9\u8c61\u7684\u5b9e\u4f8b\u3002<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\u2461\u5982\u679c\u8fd9\u4e2aBean\u5b9e\u73b0\u4e86BeanFactoryAware\u63a5\u53e3\uff0c\u4f1a\u8c03\u7528\u5b83\u5b9e\u73b0\u7684setBeanFactory()\u65b9\u6cd5\uff0c\u4f20\u9012\u7684\u662fSpring\u5de5\u5382\u81ea\u8eab\u3002<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\u2462\u5982\u679c\u8fd9\u4e2aBean\u5b9e\u73b0\u4e86ApplicationContextAware\u63a5\u53e3\uff0c\u4f1a\u8c03\u7528setApplicationContext(ApplicationContext)\u65b9\u6cd5\uff0c\u4f20\u5165Spring\u4e0a\u4e0b\u6587\uff1b<\/span><\/p>\n<\/li>\n<\/ul>\n<\/blockquote>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">\uff082\uff09\u6267\u884cBeanPostProcessor\u524d\u7f6e\u5904\u7406\uff1a<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u5982\u679c\u60f3\u5728Bean\u521d\u59cb\u5316\u524d\u8fdb\u884c\u4e00\u4e9b\u81ea\u5b9a\u4e49\u7684\u524d\u7f6e\u5904\u7406\uff0c\u90a3\u4e48\u53ef\u4ee5\u8ba9Bean\u5b9e\u73b0\u4e86BeanPostProcessor\u63a5\u53e3\uff0c\u90a3\u5c06\u4f1a\u8c03\u7528postProcessBeforeInitialization(Object obj, String s)\u65b9\u6cd5\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">\uff083\uff09\u8c03\u7528\u81ea\u5b9a\u4e49\u7684 init \u65b9\u6cd5\uff1a<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u8fd9\u4e00\u6b65\u5c31\u662f\u627e\u5230\u7528\u6237\u81ea\u5b9a\u4e49\u7684\u6784\u9020\u51fd\u6570\uff0c\u7136\u540e\u8c03\u7528\u5b83\u3002<\/span><\/p>\n<blockquote style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-top: 0px; padding-right: 15px; padding-left: 15px; outline: 0px; border-left-width: 4px; border-left-color: #dfe2e5; color: #777777; font-size: 16px; text-wrap: wrap; background-color: #ffffff; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; letter-spacing: normal; text-align: start;\">\n<p style=\"margin-bottom: 0.8em; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\u2460 \u5982\u679cBean\u5b9e\u73b0\u4e86InitializingBean\u63a5\u53e3\uff0c\u6267\u884cafeterPropertiesSet()\u65b9\u6cd5<\/span><\/p>\n<p style=\"margin-top: 0.8em; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\u2461\u5982\u679cBean\u5728Spring\u914d\u7f6e\u6587\u4ef6\u4e2d\u914d\u7f6e\u4e86 init-method \u5c5e\u6027\uff0c\u5219\u4f1a\u81ea\u52a8\u8c03\u7528\u5176\u914d\u7f6e\u7684\u521d\u59cb\u5316\u65b9\u6cd5\u3002<\/span><\/p>\n<\/blockquote>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">\uff084\uff09\u6267\u884cBeanPostProcessor\u540e\u7f6e\u5904\u7406\uff1a<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u5982\u679c\u8fd9\u4e2aBean\u5b9e\u73b0\u4e86BeanPostProcessor\u63a5\u53e3\uff0c\u5c06\u4f1a\u8c03\u7528postProcessAfterInitialization(Object obj, String s)\u65b9\u6cd5\uff1b\u7531\u4e8e\u8fd9\u4e2a\u65b9\u6cd5\u662f\u5728Bean\u521d\u59cb\u5316\u7ed3\u675f\u65f6\u8c03\u7528\u7684\uff0c\u6240\u4ee5\u53ef\u4ee5\u88ab\u5e94\u7528\u4e8e\u5185\u5b58\u6216\u7f13\u5b58\u6280\u672f\uff1b<\/span><\/p>\n<blockquote style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-top: 0px; padding-right: 15px; padding-left: 15px; outline: 0px; border-left-width: 4px; border-left-color: #dfe2e5; color: #777777; font-size: 16px; text-wrap: wrap; background-color: #ffffff; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; letter-spacing: normal; text-align: start;\">\n<p style=\"margin-bottom: 0.8em; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">\u5728\u5bb9\u5668\u542f\u52a8\u9636\u6bb5\u6211\u4eec\u8bb2\u5230BeanFactoryPostProcessor\uff0c\u8fd9\u91cc\u6211\u4eec\u8bb2\u5230BeanPostProcessor\uff0c\u90a3\u4e48BeanFactoryPostProcessor \u548c BeanPostProcessor \u6709\u4ec0\u4e48\u533a\u522b\u5462\uff1f<\/span><\/p>\n<ul class=\"list-paddingleft-1\" style=\"margin-top: 0.8em; padding-left: 30px; outline: 0px;\" data-mark=\"-\">\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">BeanFactoryPostProcessor\u5b58\u5728\u4e8e\u5bb9\u5668\u542f\u52a8\u9636\u6bb5\uff0c\u800cBeanPostProcessor\u5b58\u5728\u4e8e\u5bf9\u8c61\u5b9e\u4f8b\u5316\u9636\u6bb5\uff0cBeanFactoryPostProcessor\u5173\u6ce8\u5bf9\u8c61\u88ab\u521b\u5efa\u4e4b\u524d\u90a3\u4e9b\u914d\u7f6e\u7684\u4fee\u6539\uff0c\u800cBeanPostProcessor\u9636\u6bb5\u5173\u6ce8\u5bf9\u8c61\u5df2\u7ecf\u88ab\u521b\u5efa\u4e4b\u540e\u7684\u529f\u80fd\u589e\u5f3a\uff0c\u66ff\u6362\u7b49\u64cd\u4f5c\uff0c\u8fd9\u6837\u5c31\u5f88\u5bb9\u6613\u533a\u5206\u4e86\u3002<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<p style=\"margin-bottom: 0.5rem; outline: 0px; line-height: inherit; orphans: 4; text-align: left;\"><span style=\"outline: 0px;\">BeanPostProcessor\u4e0eBeanFactoryPostProcessor\u90fd\u662fSpring\u5728Bean\u751f\u4ea7\u8fc7\u7a0b\u4e2d\u5f3a\u6709\u529b\u7684\u6269\u5c55\u70b9\u3002Spring\u4e2d\u8457\u540d\u7684AOP(\u9762\u5411\u5207\u9762\u7f16\u7a0b)\uff0c\u5176\u5b9e\u5c31\u662f\u4f9d\u8d56BeanPostProcessor\u5bf9Bean\u5bf9\u8c61\u529f\u80fd\u589e\u5f3a\u7684\u3002<\/span><\/p>\n<\/li>\n<\/ul>\n<\/blockquote>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">5\u3001\u6ce8\u518c disposableBean\uff1a<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u8fd9\u4e00\u6b65\u5c31\u662f\u6839\u636e\u4e0d\u540c\u7684 scope \u8fdb\u884c disposableBean \u7684\u6ce8\u518c\u3002\u540c\u65f6\u4e5f\u4f1a\u6ce8\u518c\u7528\u6237\u81ea\u5b9a\u4e49\u7684\u9500\u6bc1\u903b\u8f91\uff0c\u8ddf\u81ea\u5b9a\u4e49\u7684\u521d\u59cb\u5316\u903b\u8f91\u4e00\u6837\u6709\u4e24\u79cd\u65b9\u5f0f\uff1a\uff081\uff09DisposableBean\u63a5\u53e3\u7684destory()\uff1b\uff082\uff09destory-method\u53c2\u6570\u914d\u7f6e\u7684\u65b9\u6cd5\u3002<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"cs\">protected void registerDisposableBeanIfNecessary(String beanName, Object bean, RootBeanDefinition mbd) {  AccessControlContext acc = (System.getSecurityManager() != null ? getAccessControlContext() : null);  if (!mbd.isPrototype() &amp;&amp; requiresDestruction(bean, mbd)) {        \/\/ \u5355\u4f8b\u6a21\u5f0f    if (mbd.isSingleton()) {      \/\/ \u6ce8\u518c DisposableBean      registerDisposableBean(beanName,new DisposableBeanAdapter(bean, beanName, mbd, getBeanPostProcessors(), acc));    }    else {      \/\/ A bean with a custom scope...      Scope scope = this.scopes.get(mbd.getScope());      scope.registerDestructionCallback(beanName,new DisposableBeanAdapter(bean, beanName, mbd, getBeanPostProcessors(), acc));    }  }}<\/pre>\n<\/section>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">6\u3001\u4f7f\u7528\u4e0e\u9500\u6bc1\uff1a<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u7ecf\u8fc7\u4e86\u4ee5\u4e0a\u9053\u9053\u5de5\u5e8f\uff0cSpring\u7ec8\u4e8e\u5c06Bean\u521b\u5efa\u5b8c\u6210\u4e86\uff0c\u5f53Spring\u7684Bean\u5728\u4e3a\u6211\u4eec\u670d\u52a1\u5b8c\u4e4b\u540e\uff0c\u9a6c\u4e0a\u5c31\u8981\u6d88\u4ea1\u4e86\uff08\u901a\u5e38\u662f\u5728\u5bb9\u5668\u5173\u95ed\u7684\u65f6\u5019\uff09\uff0c\u8fd9\u65f6\u5019Spring\u5c06\u4ee5\u56de\u8c03\u7684\u65b9\u5f0f\u8c03\u7528\u6211\u4eec\u81ea\u5b9a\u4e49\u7684\u9500\u6bc1\u903b\u8f91\uff0c\u7136\u540eBean\u5c31\u8fd9\u6837\u8d70\u5b8c\u4e86\u5149\u8363\u7684\u4e00\u751f\uff01<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\"><strong style=\"outline: 0px;\">7\u3001\u5c0f\u7ed3\uff1a<\/strong><\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\"><span style=\"outline: 0px;\">\u6700\u540e\uff0c\u6211\u4eec\u518d\u901a\u8fc7\u4e00\u5f20\u56fe\u6765\u4e00\u8d77\u770b\u4e00\u770bBean\u5b9e\u4f8b\u5316\u9636\u6bb5\u7684\u6267\u884c\u987a\u5e8f\u662f\u5982\u4f55\u7684\uff1a<\/span><\/p>\n<p style=\"outline: 0px; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; text-wrap: wrap; background-color: #ffffff; text-align: left;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" style=\"outline: 0px; width: 677px !important; visibility: visible !important;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154127174.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-galleryid=\"\" data-ratio=\"1.0083333333333333\" data-s=\"300,640\" data-type=\"png\" data-w=\"1080\" \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" style=\"outline: 0px; width: 677px !important; visibility: visible !important;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154127174.png\" data-galleryid=\"\" data-ratio=\"1.0083333333333333\" data-s=\"300,640\" data-type=\"png\" data-w=\"1080\" \/><\/noscript><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; outline: 0px; background-color: #ffffff; line-height: inherit; orphans: 4; white-space: pre-wrap; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI Emoji', sans-serif; font-size: 16px; letter-spacing: normal; text-align: left;\">\n<h2 style=\"margin-top: 1em; margin-bottom: 1em; outline: 0px; font-weight: bold; font-size: 1.5em; text-wrap: wrap; color: #3e3e3e; line-height: inherit; border-bottom: 2px solid black; text-align: center; font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 2px; word-spacing: 2px;\"><span style=\"outline: 0px; font-size: inherit; color: inherit; line-height: inherit;\">\u66f4\u591a\u4f18\u8d28\u6587\u7ae0<\/span><\/h2>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454676720&amp;idx=2&amp;sn=310bf6f7b388aa5b3a3d2a7975f5513e&amp;chksm=b13cdaee864b53f8b377701093c3cd3063beedf90ddbb7bccf0a3e0b53d8a3ea59460c9ccba7&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"outline: 0px; letter-spacing: 0.544px;\">1\u3001<\/span><span style=\"outline: 0px; letter-spacing: 0.544px;\">\u5fae\u670d\u52a1\u67b6\u6784\u4e0b\u7f51\u5173\u7684\u6280\u672f\u9009\u578b<\/span><\/a><\/p>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454674722&amp;idx=1&amp;sn=a2c303b4c5cb09057853e0097fa20aa2&amp;chksm=b13ce33c864b6a2ab7e4d1c33b7e2f17e8d62f76b3685bf730c2cfa911508cc5f53bd1d43789&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >2\u3001<\/a><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer; letter-spacing: 0.544px;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454676546&amp;idx=2&amp;sn=49183a21e60b98f6193e416ef593997b&amp;chksm=b13cda5c864b534ac5f5f920e201b59bdf8f3f83639ede9dbc9f88a11c284034bd791f73a9f2&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >\u540a\u6253\u9762\u8bd5\u5b98\uff0c\u6700\u5e38\u89c1\u7684 SpringCloud \u5fae\u670d\u52a1\u9762\u8bd5\u9898<\/a><\/p>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454674944&amp;idx=7&amp;sn=0c13ffc8e5fcd603f0c12509b788b173&amp;chksm=b13ce01e864b690814404aeb8cc78eea2c9bcf833ce6dc465f8a09f3da4fd2669f55cd8bdf0f&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >3\u3001\u8bbe\u8ba1\u4e00\u4e2a\u5bb9\u9519\u7684\u5fae\u670d\u52a1\u67b6\u6784<\/a><\/p>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454674944&amp;idx=3&amp;sn=345bd57e4ec8953b438fafada6bf65f2&amp;chksm=b13ce01e864b690887784edcab12b37783892bbdc65e2d021561f4d1e0aad2f6cf36f549a24f&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >4\u3001\u4e3a\u4ec0\u4e48\u5fae\u670d\u52a1\u4e00\u5b9a\u8981\u6709\u7f51\u5173\uff1f<\/a><\/p>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454674944&amp;idx=4&amp;sn=d4a660bd3dffdc4d016739da7d8fe034&amp;chksm=b13ce01e864b6908ee4719186387d279165a948f528b23f177222fe94a6bcd6fddd301fb4d76&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >5\u3001\u4e3b\u6d41\u5fae\u670d\u52a1\u5168\u94fe\u8def\u76d1\u63a7\u7cfb\u7edf\u4e4b\u6218<\/a><\/p>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454674944&amp;idx=5&amp;sn=90e4e2d80e3c2f386710f9ce6204d4f0&amp;chksm=b13ce01e864b690858339e7c555cf70e7125257bd69c9a6cb8ae53934e45eda6373d561ed066&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >6\u3001\u5168\u9762\u89e3\u6790\u5fae\u670d\u52a1\u7cfb\u7edf\u76d1\u63a7\u5206\u5c42\uff0c\u5543\u900f\u670d\u52a1\u6cbb\u7406\u6838\u5fc3\uff01<\/a><\/p>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454674944&amp;idx=7&amp;sn=0c13ffc8e5fcd603f0c12509b788b173&amp;chksm=b13ce01e864b690814404aeb8cc78eea2c9bcf833ce6dc465f8a09f3da4fd2669f55cd8bdf0f&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >7\u3001\u8bbe\u8ba1\u4e00\u4e2a\u5bb9\u9519\u7684\u5fae\u670d\u52a1\u67b6\u6784<\/a><\/p>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer; letter-spacing: 0.544px;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454674458&amp;idx=2&amp;sn=fdac070b8599a2a40eae735f21d09ef0&amp;chksm=b13ce204864b6b12f552b95f6d16db7db51d296695d96de418d084c55c90f520648e29a6f58a&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >8\u3001\u6df1\u6316\uff0c\u4e00\u6587\u641e\u61c2 Sentinel \u9650\u6d41\u7194\u65ad\uff01<\/a><\/p>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454674458&amp;idx=3&amp;sn=040cfb8f5efe55da396c55a0e39f6958&amp;chksm=b13ce204864b6b1229c7446467274754a9458f27105709200a28245fff22fe2ab509a584680a&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >9\u3001\u4ece\u96f6\u642d\u5efa SpringCloud Alibaba \u9274\u6743\u4e2d\u5fc3\u670d\u52a1\uff08\u8be6\u7ec6\u6559\u7a0b\uff09<\/a><\/p>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454672487&amp;idx=3&amp;sn=49b6176dae2bb4fe41f4855995a2d7ba&amp;chksm=b13cea79864b636f01a69dae824551a45f12702c323042d65c212ecf193bec50361fe1ddefcf&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >10\u3001\u4ec0\u4e48\u662f\u811a\u624b\u67b6\uff1f\u4e3a\u4ec0\u4e48\u9700\u8981\u811a\u624b\u67b6\uff1f\u5e38\u7528\u7684\u811a\u624b\u67b6\u6709\u54ea\u4e9b\uff1f<\/a><\/p>\n<h1 style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454671594&amp;idx=4&amp;sn=6b45baf8e9907de4c67b71caf1b01c28&amp;chksm=b13ceef4864b67e29357053e3dabac97315aad88664a2580ddda71fd13262defa77fde57a1d9&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >11\u3001\u9886\u57df\u9a71\u52a8\u8bbe\u8ba1\uff08DDD\uff09\u7684\u51e0\u79cd\u5178\u578b\u67b6\u6784\u4ecb\u7ecd<\/a><\/h1>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454671295&amp;idx=1&amp;sn=b9c2823845b5c95593d323b87b76861b&amp;chksm=b13cf1a1864b78b74a9b3d0ae27e304e15109f760f80a1bde99aed7cd3aa92562264ff11201f&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >12\u3001\u5fae\u670d\u52a1\u7f51\u5173\u9274\u6743\uff1agateway\u4f7f\u7528\u3001\u7f51\u5173\u9650\u6d41\u4f7f\u7528\u3001\u7528\u6237\u5bc6\u7801\u52a0\u5bc6\u3001JWT\u9274\u6743<\/a><\/p>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454669891&amp;idx=3&amp;sn=814e6105c73ab075af0f545e5e9e70dc&amp;chksm=b13cf45d864b7d4b716bb8415b3994f18664ed6c0f60c581234af394d7e32cbbf3db89e33d2a&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >13\u3001Spring Cloud Sleuth \u5168\u94fe\u8def\u65e5\u5fd7\u8ddf\u8e2a\u89e3\u51b3\u65b9\u6848\uff08\u5f3a\u70c8\u63a8\u8350\uff09<\/a><\/p>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454669638&amp;idx=3&amp;sn=001ff8da83df60c765ad48391c7d45ee&amp;chksm=b13cf758864b7e4eca450e951472dfced478a2d7bc29a17147880f570ec2f434b08c1696a0a3&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >14\u3001SpringCloud\u6574\u5408Alibaba Seata\u5b9e\u73b0\u5206\u5e03\u5f0f\u4e8b\u52a1<\/a><\/p>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454677853&amp;idx=2&amp;sn=ac6ed9a4466b1651be734846cd2887b4&amp;chksm=b13cd743864b5e552f37cb2a99178dcdb2f15e0e8946200dcb175d08e7bd78fdd38b1a273eba&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >15\u3001\u5982\u4f55\u6784\u5efa\u57fa\u4e8e DDD \u9886\u57df\u9a71\u52a8\u7684\u5fae\u670d\u52a1\uff1f<\/a><\/p>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454677853&amp;idx=3&amp;sn=fa7093427a973d460e3af45093927f43&amp;chksm=b13cd743864b5e554c6abb01049a0d08e2d4ed20d78c9cd4c6b71cc0a171311db008f16f1863&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >16\u3001\u57fa\u4e8eSpring Cloud\u7684\u5fae\u670d\u52a1\u67b6\u6784\u5206\u6790<\/a><\/p>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454677752&amp;idx=2&amp;sn=c01ebf3fc8803700c99eef6f006fc638&amp;chksm=b13cd6e6864b5ff092a6cd4ca845a62e08229847f89c982128b8758a5ceebb0d4117fda02a7c&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" >17\u300125000 \u5b57\u8be6\u89e3 23 \u79cd\u8bbe\u8ba1\u6a21\u5f0f\uff0c\u5efa\u8bae\u6536\u85cf<\/a><\/p>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454678424&amp;idx=3&amp;sn=be09ffc121265599d4abfcb12e17114d&amp;chksm=b13cd586864b5c9037910b86c87461979e84e739c303794199aa50ab8720a9d00b470ed12b50&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"outline: 0px; letter-spacing: 0.544px;\">18\u3001<\/span><span style=\"outline: 0px; letter-spacing: 0.544px;\">Nginx \u8f7b\u677e\u641e\u5b9a\u8de8\u57df\u95ee\u9898<\/span><\/a><\/p>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454677449&amp;idx=2&amp;sn=f5d731cd1171fa48648334adff35271a&amp;chksm=b13cd9d7864b50c1f477d868dc3b8cf7903676bee312df08776c528652ffd368e1f5bf7eca85&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"outline: 0px; letter-spacing: 0.544px;\">19\u3001<\/span><span style=\"outline: 0px; letter-spacing: 0.544px;\">JAVA\u5f00\u53d1\u5229\u5668\u4e4bArthas\uff0c\u5feb\u901f\u5b9a\u4f4d\u7ebf\u4e0a\u95ee\u9898<\/span><\/a><\/p>\n<p style=\"outline: 0px;\"><a style=\"outline: 0px; color: var(--weui-link); cursor: pointer;\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MjM5NDQ4MzA1Nw==&amp;mid=2454676868&amp;idx=1&amp;sn=9f51e163a9646cf0f16acd333da55e6f&amp;chksm=b13cdb9a864b528cdd456ed3f26ee29fd2d254dc6ad80656b937085f1e7cb9743bd57471e088&amp;scene=21#wechat_redirect\" target=\"_blank\" rel=\"noopener\" data-itemshowtype=\"0\" data-linktype=\"2\" rel=\"nofollow\" ><span style=\"outline: 0px; letter-spacing: 0.544px;\">20\u3001<\/span><span style=\"outline: 0px; letter-spacing: 0.544px;\">\u9762\u8bd5\u5b98\uff1a\u8bbe\u8ba1\u4e00\u4e2a\u9ad8\u6d41\u91cf\u9ad8\u5e76\u53d1\u7684\u7cfb\u7edf\uff0c\u6709\u54ea\u4e9b\u8981\u70b9\uff1f<\/span><\/a><\/p>\n<p style=\"outline: 0px;\">\n<section class=\"mp_profile_iframe_wrp\" style=\"outline: 0px; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; text-wrap: wrap;\"><\/section>\n<p style=\"margin-top: 10px; margin-bottom: 10px; outline: 0px; letter-spacing: 0.544px; white-space: normal; color: #3e3e3e; text-align: center; word-spacing: 2px; font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; line-height: 2em;\"><span style=\"outline: 0px; font-size: 13px; letter-spacing: 0.5px; color: #0080ff; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;\">\u5982\u559c\u6b22\u672c\u6587\uff0c\u8bf7\u70b9\u51fb\u53f3\u4e0a\u89d2\uff0c\u628a\u6587\u7ae0\u5206\u4eab\u5230\u670b\u53cb\u5708<br style=\"outline: 0px;\" \/><\/span><\/p>\n<p style=\"margin-top: 10px; margin-bottom: 10px; outline: 0px; letter-spacing: 0.544px; white-space: normal; color: #3e3e3e; text-align: center; word-spacing: 2px; font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; line-height: 2em;\"><strong style=\"outline: 0px;\"><span style=\"outline: 0px; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; font-size: 13px; letter-spacing: 0.5px; color: #d92142;\">\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;\">\u7b2c\u4e00\u65f6\u95f4\u83b7\u53d6\u7cbe\u5f69\u6280\u672f\u5206\u4eab<\/span><\/span><\/strong><\/p>\n<p style=\"margin-top: 10px; margin-bottom: 10px; outline: 0px; letter-spacing: 0.544px; white-space: normal; color: #3e3e3e; text-align: center; word-spacing: 2px; font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; line-height: 2em;\"><strong style=\"outline: 0px; letter-spacing: 0.544px; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 16.3636px;\">\u00b7END\u00b7<\/strong><\/p>\n<p style=\"display: none;\">\n<blockquote><p>\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e\u5fae\u4fe1\u516c\u4f17\u53f7: IT\u725b\u5ba2<\/p><\/blockquote>\n<\/div>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>Spring IOC\u5bb9\u5668\u5c31\u50cf\u662f\u4e00\u4e2a\u751f\u4ea7\u4ea7\u54c1\u7684\u6d41\u6c34\u7ebf\u4e0a\u7684\u673a\u5668\uff0cSpring\u521b\u5efa\u51fa\u6765\u7684Bean\u5c31\u597d\u50cf\u662f\u6d41\u6c34\u7ebf\u7684\u7ec8\u70b9\u751f\u4ea7\u51fa\u6765\u7684\u4e00\u4e2a\u4e2a\u7cbe\u7f8e &#8230;<\/p>\n","protected":false},"author":1,"featured_media":2406,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[6],"tags":[],"class_list":["post-2410","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring"],"post_thumbnail_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154117946-150x150.jpeg","content_first_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154118814.png","post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154117946-300x128.jpeg","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154117946-1024x436.jpeg","post_frist_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154118814.png","post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154117946-300x128.jpeg","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154117946-1024x436.jpeg","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154117946.jpeg","post_all_images":[{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154118814.png","id":"image0"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154118814.png","id":"image1"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154119505.png","id":"image2"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154119505.png","id":"image3"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154127174.png","id":"image4"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/06\/20230627154127174.png","id":"image5"}],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"Spring","post_date":"2023-06-29","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":369,"next_post_id":2933,"next_post_title":"Spring \u8d4c\u4e0a\u672a\u6765\u7684\u4e00\u51fb\uff0c\u54cd\u5e94\u5f0f\u7684 WebFlux \u6846\u67b6\u66f4\u4f18\u96c5\uff0c\u6027\u80fd\u66f4\u5f3a\uff01","previous_post_id":1945,"previous_post_title":"\u5229\u7528Spring\u5b9e\u73b0\u7b56\u7565\u6a21\u5f0f","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/2410","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=2410"}],"version-history":[{"count":0,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/2410\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media\/2406"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2410"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2410"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2410"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}