{"id":107297,"date":"2026-09-19T10:08:40","date_gmt":"2026-09-19T02:08:40","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/107297.html"},"modified":"2026-09-19T10:08:40","modified_gmt":"2026-09-19T02:08:40","slug":"spring-bean-%e7%9a%84%e7%94%9f%e5%91%bd%e5%91%a8%e6%9c%9f%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/107297.html","title":{"rendered":"Spring Bean \u7684\u751f\u547d\u5468\u671f\u8be6\u89e3"},"content":{"rendered":"<h2>Spring Bean \u7684\u751f\u547d\u5468\u671f\u8be6\u89e3<\/h2>\n<h3>\u4e00\u3001\u4ec0\u4e48\u662f Bean \u7684\u751f\u547d\u5468\u671f&#xff1f;<\/h3>\n<p>Bean \u7684\u751f\u547d\u5468\u671f\u662f\u6307\u4ece Spring \u5bb9\u5668\u521b\u5efa Bean \u5b9e\u4f8b\u5f00\u59cb&#xff0c;\u5230\u6700\u7ec8\u9500\u6bc1 Bean \u7684\u6574\u4e2a\u8fc7\u7a0b\u3002\u7406\u89e3\u8fd9\u4e2a\u8fc7\u7a0b&#xff0c;\u80fd\u5e2e\u4f60\u641e\u6e05\u695a\u5f88\u591a\u95ee\u9898&#xff1a;\u4e3a\u4ec0\u4e48 &#064;PostConstruct \u80fd\u5728\u4f9d\u8d56\u6ce8\u5165\u5b8c\u6210\u540e\u6267\u884c\u3001AOP \u4ee3\u7406\u662f\u5728\u54ea\u4e2a\u9636\u6bb5\u751f\u6210\u7684\u3001&#064;PreDestroy \u4e3a\u4ec0\u4e48\u6709\u65f6\u5019\u4e0d\u751f\u6548\u3002<\/p>\n<h3>\u4e8c\u3001\u5b8c\u6574\u751f\u547d\u5468\u671f\u6d41\u7a0b<\/h3>\n<p>Spring Bean \u7684\u751f\u547d\u5468\u671f\u53ef\u4ee5\u6982\u62ec\u4e3a\u56db\u4e2a\u5927\u9636\u6bb5&#xff1a;\u5b9e\u4f8b\u5316 \u2192 \u5c5e\u6027\u586b\u5145 \u2192 \u521d\u59cb\u5316 \u2192 \u9500\u6bc1\u3002\u4f46\u5728\u8fd9\u56db\u4e2a\u9636\u6bb5\u4e4b\u95f4&#xff0c;\u7a7f\u63d2\u7740\u591a\u4e2a\u6269\u5c55\u70b9\u3002<\/p>\n<p>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502                     Bean \u751f\u547d\u5468\u671f\u5b8c\u6574\u6d41\u7a0b                        \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502                                                                 \u2502<br \/>\n\u2502  \u2460 \u5b9e\u4f8b\u5316&#xff08;Instantiation&#xff09;                                      \u2502<br \/>\n\u2502     \u2514\u2500\u2500 \u901a\u8fc7\u53cd\u5c04\u8c03\u7528\u6784\u9020\u65b9\u6cd5\u521b\u5efa\u5bf9\u8c61                            \u2502<br \/>\n\u2502                                                                 \u2502<br \/>\n\u2502  \u2461 \u5c5e\u6027\u586b\u5145&#xff08;Populate&#xff09;                                         \u2502<br \/>\n\u2502     \u2514\u2500\u2500 \u4f9d\u8d56\u6ce8\u5165&#xff08;&#064;Autowired\u3001&#064;Value&#xff09;                          \u2502<br \/>\n\u2502                                                                 \u2502<br \/>\n\u2502  \u2462 Aware \u63a5\u53e3\u56de\u8c03                                               \u2502<br \/>\n\u2502     \u251c\u2500\u2500 BeanNameAware.setBeanName()                             \u2502<br \/>\n\u2502     \u251c\u2500\u2500 BeanFactoryAware.setBeanFactory()                       \u2502<br \/>\n\u2502     \u251c\u2500\u2500 ApplicationContextAware.setApplicationContext()         \u2502<br \/>\n\u2502     \u2514\u2500\u2500 \u5176\u4ed6 Aware \u63a5\u53e3                                         \u2502<br \/>\n\u2502                                                                 \u2502<br \/>\n\u2502  \u2463 BeanPostProcessor.postProcessBeforeInitialization()          \u2502<br \/>\n\u2502     \u2514\u2500\u2500 \u521d\u59cb\u5316\u524d\u589e\u5f3a                                            \u2502<br \/>\n\u2502                                                                 \u2502<br \/>\n\u2502  \u2464 \u521d\u59cb\u5316&#xff08;Initialization&#xff09;                                     \u2502<br \/>\n\u2502     \u251c\u2500\u2500 &#064;PostConstruct \u6807\u6ce8\u7684\u65b9\u6cd5                               \u2502<br \/>\n\u2502     \u251c\u2500\u2500 InitializingBean.afterPropertiesSet()                   \u2502<br \/>\n\u2502     \u2514\u2500\u2500 init-method \u6216 &#064;Bean(initMethod &#061; &#034;&#8230;&#034;)                \u2502<br \/>\n\u2502                                                                 \u2502<br \/>\n\u2502  \u2465 BeanPostProcessor.postProcessAfterInitialization()           \u2502<br \/>\n\u2502     \u2514\u2500\u2500 \u521d\u59cb\u5316\u540e\u589e\u5f3a&#xff08;AOP \u4ee3\u7406\u5728\u6b64\u751f\u6210&#xff09;                        \u2502<br \/>\n\u2502                                                                 \u2502<br \/>\n\u2502  \u2466 Bean \u5c31\u7eea&#xff0c;\u53ef\u4ee5\u4f7f\u7528                                          \u2502<br \/>\n\u2502                                                                 \u2502<br \/>\n\u2502  \u2467 \u5bb9\u5668\u5173\u95ed&#xff0c;\u9500\u6bc1 Bean                                          \u2502<br \/>\n\u2502     \u251c\u2500\u2500 &#064;PreDestroy \u6807\u6ce8\u7684\u65b9\u6cd5                                  \u2502<br \/>\n\u2502     \u251c\u2500\u2500 DisposableBean.destroy()                                \u2502<br \/>\n\u2502     \u2514\u2500\u2500 destroy-method \u6216 &#064;Bean(destroyMethod &#061; &#034;&#8230;&#034;)          \u2502<br \/>\n\u2502                                                                 \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<h3>\u4e09\u3001\u5404\u9636\u6bb5\u8be6\u89e3<\/h3>\n<h4>3.1 \u5b9e\u4f8b\u5316&#xff08;Instantiation&#xff09;<\/h4>\n<p>Spring \u901a\u8fc7\u53cd\u5c04\u8c03\u7528\u6784\u9020\u65b9\u6cd5\u521b\u5efa Bean \u5b9e\u4f8b\u3002\u5982\u679c\u4f7f\u7528\u6784\u9020\u5668\u6ce8\u5165&#xff0c;\u4f9d\u8d56\u5728\u6b64\u65f6\u4f5c\u4e3a\u53c2\u6570\u4f20\u5165\u3002\u5982\u679c\u4f7f\u7528\u5b57\u6bb5\u6ce8\u5165&#xff0c;\u6b64\u65f6\u5bf9\u8c61\u5df2\u521b\u5efa&#xff0c;\u4f46\u4f9d\u8d56\u5b57\u6bb5\u8fd8\u662f null\u3002<\/p>\n<p><span class=\"token annotation punctuation\">&#064;Service<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">UserService<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token annotation punctuation\">&#064;Autowired<\/span><br \/>\n    <span class=\"token keyword\">private<\/span> <span class=\"token class-name\">UserDao<\/span> userDao<span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ \u6b64\u65f6\u8fd8\u662f null<\/span><\/p>\n<p>    <span class=\"token keyword\">public<\/span> <span class=\"token class-name\">UserService<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;1. \u6784\u9020\u65b9\u6cd5\u6267\u884c&#xff0c;userDao &#061; &#034;<\/span> <span class=\"token operator\">&#043;<\/span> userDao<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ null<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>3.2 \u5c5e\u6027\u586b\u5145&#xff08;Populate&#xff09;<\/h4>\n<p>Spring \u626b\u63cf Bean \u4e2d\u6807\u6ce8\u4e86 &#064;Autowired\u3001&#064;Value\u3001&#064;Resource \u7684\u5b57\u6bb5\u548c\u65b9\u6cd5&#xff0c;\u4ece\u5bb9\u5668\u4e2d\u67e5\u627e\u5339\u914d\u7684\u4f9d\u8d56\u5e76\u6ce8\u5165\u3002<\/p>\n<p><span class=\"token annotation punctuation\">&#064;Autowired<\/span><br \/>\n<span class=\"token keyword\">private<\/span> <span class=\"token class-name\">UserDao<\/span> userDao<span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ \u6b64\u65f6\u88ab\u6ce8\u5165<\/span><\/p>\n<p><span class=\"token annotation punctuation\">&#064;Value<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;${app.name}&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">private<\/span> <span class=\"token class-name\">String<\/span> appName<span class=\"token punctuation\">;<\/span>   <span class=\"token comment\">\/\/ \u6b64\u65f6\u88ab\u6ce8\u5165<\/span><\/p>\n<p>\u5982\u679c\u4f9d\u8d56\u662f\u5faa\u73af\u4f9d\u8d56&#xff0c;Spring \u901a\u8fc7\u4e09\u7ea7\u7f13\u5b58\u63d0\u524d\u66b4\u9732\u5bf9\u8c61\u7684\u65e9\u671f\u5f15\u7528&#xff0c;\u8ba9\u4f9d\u8d56\u65b9\u5148\u62ff\u5230\u5f15\u7528\u3002<\/p>\n<h4>3.3 Aware \u63a5\u53e3\u56de\u8c03<\/h4>\n<p>\u5982\u679c Bean \u5b9e\u73b0\u4e86 Aware \u7cfb\u5217\u63a5\u53e3&#xff0c;Spring \u4f1a\u8c03\u7528\u5bf9\u5e94\u7684\u65b9\u6cd5&#xff0c;\u8ba9 Bean \u83b7\u53d6\u5bb9\u5668\u5185\u90e8\u7684\u4e00\u4e9b\u8d44\u6e90\u3002<\/p>\n<table>\n<tr>Aware \u63a5\u53e3\u56de\u8c03\u65b9\u6cd5\u83b7\u53d6\u7684\u8d44\u6e90<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">BeanNameAware<\/td>\n<td align=\"left\">setBeanName(String)<\/td>\n<td align=\"left\">Bean \u7684\u540d\u79f0<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">BeanFactoryAware<\/td>\n<td align=\"left\">setBeanFactory(BeanFactory)<\/td>\n<td align=\"left\">BeanFactory \u5b9e\u4f8b<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">ApplicationContextAware<\/td>\n<td align=\"left\">setApplicationContext(ApplicationContext)<\/td>\n<td align=\"left\">ApplicationContext \u5b9e\u4f8b<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">EnvironmentAware<\/td>\n<td align=\"left\">setEnvironment(Environment)<\/td>\n<td align=\"left\">Environment \u5b9e\u4f8b<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">ResourceLoaderAware<\/td>\n<td align=\"left\">setResourceLoader(ResourceLoader)<\/td>\n<td align=\"left\">\u8d44\u6e90\u52a0\u8f7d\u5668<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">ApplicationEventPublisherAware<\/td>\n<td align=\"left\">setApplicationEventPublisher(&#8230;)<\/td>\n<td align=\"left\">\u4e8b\u4ef6\u53d1\u5e03\u5668<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span class=\"token annotation punctuation\">&#064;Component<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">MyBean<\/span> <span class=\"token keyword\">implements<\/span> <span class=\"token class-name\">BeanNameAware<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">ApplicationContextAware<\/span> <span class=\"token punctuation\">{<\/span><\/p>\n<p>    <span class=\"token annotation punctuation\">&#064;Override<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">setBeanName<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span> name<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;3. Bean \u540d\u79f0: &#034;<\/span> <span class=\"token operator\">&#043;<\/span> name<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token annotation punctuation\">&#064;Override<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">setApplicationContext<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">ApplicationContext<\/span> context<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;3. \u83b7\u53d6\u5230 ApplicationContext&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>3.4 BeanPostProcessor \u524d\u7f6e\u5904\u7406<\/h4>\n<p>BeanPostProcessor \u662f Spring \u6700\u91cd\u8981\u7684\u6269\u5c55\u70b9\u4e4b\u4e00\u3002\u5b83\u7684 postProcessBeforeInitialization \u65b9\u6cd5\u4f1a\u5728\u6240\u6709\u521d\u59cb\u5316\u65b9\u6cd5\u6267\u884c\u4e4b\u524d\u88ab\u8c03\u7528\u3002<\/p>\n<p><span class=\"token annotation punctuation\">&#064;Component<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">MyBeanPostProcessor<\/span> <span class=\"token keyword\">implements<\/span> <span class=\"token class-name\">BeanPostProcessor<\/span> <span class=\"token punctuation\">{<\/span><\/p>\n<p>    <span class=\"token annotation punctuation\">&#064;Override<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token class-name\">Object<\/span> <span class=\"token function\">postProcessBeforeInitialization<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Object<\/span> bean<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">String<\/span> beanName<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;4. \u521d\u59cb\u5316\u524d: &#034;<\/span> <span class=\"token operator\">&#043;<\/span> beanName<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> bean<span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ \u8fd4\u56de null \u5219\u4e0d\u4f1a\u7ee7\u7eed\u540e\u7eed\u5904\u7406<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token annotation punctuation\">&#064;Override<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token class-name\">Object<\/span> <span class=\"token function\">postProcessAfterInitialization<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Object<\/span> bean<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">String<\/span> beanName<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;6. \u521d\u59cb\u5316\u540e: &#034;<\/span> <span class=\"token operator\">&#043;<\/span> beanName<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> bean<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u5982\u679c\u8fd4\u56de null&#xff0c;Spring \u4e0d\u4f1a\u7ee7\u7eed\u6267\u884c\u540e\u7eed\u7684\u521d\u59cb\u5316\u6d41\u7a0b&#xff0c;Bean \u4e5f\u4e0d\u4f1a\u88ab\u6ce8\u518c\u5230\u5bb9\u5668\u4e2d\u3002<\/p>\n<h4>3.5 \u521d\u59cb\u5316&#xff08;Initialization&#xff09;<\/h4>\n<p>\u521d\u59cb\u5316\u9636\u6bb5\u6309\u4ee5\u4e0b\u987a\u5e8f\u6267\u884c&#xff1a;<\/p>\n<p>1. &#064;PostConstruct \u6807\u6ce8\u7684\u65b9\u6cd5<\/p>\n<p><span class=\"token annotation punctuation\">&#064;PostConstruct<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">init<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;5.1 &#064;PostConstruct \u6267\u884c&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>2. InitializingBean.afterPropertiesSet()<\/p>\n<p><span class=\"token annotation punctuation\">&#064;Component<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">MyBean<\/span> <span class=\"token keyword\">implements<\/span> <span class=\"token class-name\">InitializingBean<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token annotation punctuation\">&#064;Override<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">afterPropertiesSet<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;5.2 afterPropertiesSet \u6267\u884c&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>3. init-method \u6216 &#064;Bean(initMethod &#061; &#034;&#8230;&#034;)<\/p>\n<p><span class=\"token annotation punctuation\">&#064;Bean<\/span><span class=\"token punctuation\">(<\/span>initMethod <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;customInit&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token class-name\">MyBean<\/span> <span class=\"token function\">myBean<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">MyBean<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/\/ MyBean \u4e2d\u5b9a\u4e49 customInit \u65b9\u6cd5<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">customInit<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;5.3 init-method \u6267\u884c&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u6267\u884c\u987a\u5e8f&#xff1a;&#064;PostConstruct \u2192 afterPropertiesSet() \u2192 init-method<\/p>\n<h4>3.6 BeanPostProcessor \u540e\u7f6e\u5904\u7406<\/h4>\n<p>postProcessAfterInitialization \u5728\u6240\u6709\u521d\u59cb\u5316\u65b9\u6cd5\u6267\u884c\u4e4b\u540e\u88ab\u8c03\u7528\u3002AOP \u4ee3\u7406\u5c31\u662f\u5728\u8fd9\u4e2a\u9636\u6bb5\u751f\u6210\u7684\u3002<\/p>\n<p><span class=\"token annotation punctuation\">&#064;Override<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token class-name\">Object<\/span> <span class=\"token function\">postProcessAfterInitialization<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Object<\/span> bean<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">String<\/span> beanName<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u5982\u679c Bean \u9700\u8981\u88ab AOP \u4ee3\u7406&#xff0c;\u8fd9\u91cc\u8fd4\u56de\u4ee3\u7406\u5bf9\u8c61<\/span><br \/>\n    <span class=\"token comment\">\/\/ Spring \u7684 AbstractAutoProxyCreator \u5c31\u662f\u5728\u8fd9\u91cc\u521b\u5efa\u4ee3\u7406\u7684<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> bean<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u5982\u679c Bean \u88ab AOP \u4ee3\u7406&#xff0c;\u5bb9\u5668\u4e2d\u6700\u7ec8\u5b58\u653e\u7684\u662f\u4ee3\u7406\u5bf9\u8c61&#xff0c;\u800c\u4e0d\u662f\u539f\u59cb\u5bf9\u8c61\u3002\u8fd9\u4e5f\u89e3\u91ca\u4e86\u4e3a\u4ec0\u4e48 &#064;Transactional \u6ce8\u89e3\u7684\u65b9\u6cd5\u5fc5\u987b\u901a\u8fc7\u4ee3\u7406\u8c03\u7528\u624d\u751f\u6548\u3002<\/p>\n<h4>3.7 Bean \u5c31\u7eea<\/h4>\n<p>\u7ecf\u8fc7\u4ee5\u4e0a\u6240\u6709\u9636\u6bb5\u540e&#xff0c;Bean \u88ab\u653e\u5165\u5355\u4f8b\u6c60&#xff08;singletonObjects&#xff09;&#xff0c;\u53ef\u4ee5\u88ab\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u3002<\/p>\n<h4>3.8 \u9500\u6bc1&#xff08;Destruction&#xff09;<\/h4>\n<p>\u5bb9\u5668\u5173\u95ed\u65f6&#xff0c;Bean \u7684\u9500\u6bc1\u6d41\u7a0b\u6309\u4ee5\u4e0b\u987a\u5e8f\u6267\u884c&#xff1a;<\/p>\n<p>1. &#064;PreDestroy \u6807\u6ce8\u7684\u65b9\u6cd5<\/p>\n<p><span class=\"token annotation punctuation\">&#064;PreDestroy<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">preDestroy<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;8.1 &#064;PreDestroy \u6267\u884c&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>2. DisposableBean.destroy()<\/p>\n<p><span class=\"token annotation punctuation\">&#064;Component<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">MyBean<\/span> <span class=\"token keyword\">implements<\/span> <span class=\"token class-name\">DisposableBean<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token annotation punctuation\">&#064;Override<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">destroy<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;8.2 destroy \u6267\u884c&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>3. destroy-method \u6216 &#064;Bean(destroyMethod &#061; &#034;&#8230;&#034;)<\/p>\n<p><span class=\"token annotation punctuation\">&#064;Bean<\/span><span class=\"token punctuation\">(<\/span>destroyMethod <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;customDestroy&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token class-name\">MyBean<\/span> <span class=\"token function\">myBean<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">MyBean<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u6267\u884c\u987a\u5e8f&#xff1a;&#064;PreDestroy \u2192 destroy() \u2192 destroy-method<\/p>\n<h3>\u56db\u3001\u5b8c\u6574\u793a\u4f8b<\/h3>\n<p><span class=\"token annotation punctuation\">&#064;Component<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">LifecycleBean<\/span> <span class=\"token keyword\">implements<\/span> <span class=\"token class-name\">BeanNameAware<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">InitializingBean<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">DisposableBean<\/span> <span class=\"token punctuation\">{<\/span><\/p>\n<p>    <span class=\"token annotation punctuation\">&#064;Autowired<\/span><br \/>\n    <span class=\"token keyword\">private<\/span> <span class=\"token class-name\">UserDao<\/span> userDao<span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">public<\/span> <span class=\"token class-name\">LifecycleBean<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;1. \u6784\u9020\u65b9\u6cd5\u6267\u884c&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token annotation punctuation\">&#064;Override<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">setBeanName<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span> name<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;3. BeanNameAware.setBeanName: &#034;<\/span> <span class=\"token operator\">&#043;<\/span> name<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token annotation punctuation\">&#064;PostConstruct<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">postConstruct<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;5.1 &#064;PostConstruct \u6267\u884c&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token annotation punctuation\">&#064;Override<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">afterPropertiesSet<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;5.2 afterPropertiesSet \u6267\u884c&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">customInit<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;5.3 init-method \u6267\u884c&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token annotation punctuation\">&#064;PreDestroy<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">preDestroy<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;8.1 &#064;PreDestroy \u6267\u884c&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token annotation punctuation\">&#064;Override<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">destroy<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;8.2 destroy \u6267\u884c&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">customDestroy<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;8.3 destroy-method \u6267\u884c&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u914d\u7f6e&#xff1a;<\/p>\n<p><span class=\"token annotation punctuation\">&#064;Bean<\/span><span class=\"token punctuation\">(<\/span>initMethod <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;customInit&#034;<\/span><span class=\"token punctuation\">,<\/span> destroyMethod <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;customDestroy&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token class-name\">LifecycleBean<\/span> <span class=\"token function\">lifecycleBean<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">LifecycleBean<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u8f93\u51fa&#xff1a;<\/p>\n<p>1. \u6784\u9020\u65b9\u6cd5\u6267\u884c<br \/>\n2. \u5c5e\u6027\u586b\u5145&#xff08;\u4f9d\u8d56\u6ce8\u5165&#xff09;<br \/>\n3. BeanNameAware.setBeanName: lifecycleBean<br \/>\n4. BeanPostProcessor.postProcessBeforeInitialization<br \/>\n5.1 &#064;PostConstruct \u6267\u884c<br \/>\n5.2 afterPropertiesSet \u6267\u884c<br \/>\n5.3 init-method \u6267\u884c<br \/>\n6. BeanPostProcessor.postProcessAfterInitialization<br \/>\n7. Bean \u5c31\u7eea<br \/>\n&#8230; \u5e94\u7528\u8fd0\u884c &#8230;<br \/>\n8.1 &#064;PreDestroy \u6267\u884c<br \/>\n8.2 destroy \u6267\u884c<br \/>\n8.3 destroy-method \u6267\u884c<\/p>\n<h3>\u4e94\u3001\u4f5c\u7528\u57df\u5bf9\u751f\u547d\u5468\u671f\u7684\u5f71\u54cd<\/h3>\n<table>\n<tr>\u4f5c\u7528\u57df\u751f\u547d\u5468\u671f<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">singleton<\/td>\n<td align=\"left\">\u5bb9\u5668\u542f\u52a8\u65f6\u521b\u5efa&#xff0c;\u5bb9\u5668\u5173\u95ed\u65f6\u9500\u6bc1<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">prototype<\/td>\n<td align=\"left\">\u6bcf\u6b21\u83b7\u53d6\u65f6\u521b\u5efa&#xff0c;Spring \u4e0d\u7ba1\u7406\u9500\u6bc1&#xff08;\u9700\u8981\u8c03\u7528\u65b9\u81ea\u884c\u5904\u7406&#xff09;<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">request<\/td>\n<td align=\"left\">\u6bcf\u6b21 HTTP \u8bf7\u6c42\u521b\u5efa&#xff0c;\u8bf7\u6c42\u7ed3\u675f\u65f6\u9500\u6bc1<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">session<\/td>\n<td align=\"left\">\u6bcf\u4e2a\u4f1a\u8bdd\u521b\u5efa&#xff0c;\u4f1a\u8bdd\u5931\u6548\u65f6\u9500\u6bc1<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">application<\/td>\n<td align=\"left\">\u6574\u4e2a ServletContext \u751f\u547d\u5468\u671f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>prototype \u4f5c\u7528\u57df\u7684 Bean&#xff0c;Spring \u53ea\u8d1f\u8d23\u521b\u5efa&#xff0c;\u4e0d\u8d1f\u8d23\u9500\u6bc1\u3002&#064;PreDestroy \u548c DisposableBean \u4e0d\u4f1a\u751f\u6548\u3002<\/p>\n<h3>\u516d\u3001\u751f\u547d\u5468\u671f\u4e2d\u7684\u6269\u5c55\u70b9<\/h3>\n<table>\n<tr>\u6269\u5c55\u70b9\u7c7b\u578b\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">BeanPostProcessor<\/td>\n<td align=\"left\">\u63a5\u53e3<\/td>\n<td align=\"left\">\u5728\u521d\u59cb\u5316\u524d\u540e\u589e\u5f3a Bean<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">InstantiationAwareBeanPostProcessor<\/td>\n<td align=\"left\">\u63a5\u53e3<\/td>\n<td align=\"left\">\u5728\u5b9e\u4f8b\u5316\u524d\u540e\u589e\u5f3a Bean<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">&#064;PostConstruct<\/td>\n<td align=\"left\">\u6ce8\u89e3<\/td>\n<td align=\"left\">\u521d\u59cb\u5316\u65b9\u6cd5<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">InitializingBean<\/td>\n<td align=\"left\">\u63a5\u53e3<\/td>\n<td align=\"left\">\u521d\u59cb\u5316\u65b9\u6cd5<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">init-method<\/td>\n<td align=\"left\">XML\/\u6ce8\u89e3<\/td>\n<td align=\"left\">\u521d\u59cb\u5316\u65b9\u6cd5<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">&#064;PreDestroy<\/td>\n<td align=\"left\">\u6ce8\u89e3<\/td>\n<td align=\"left\">\u9500\u6bc1\u65b9\u6cd5<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">DisposableBean<\/td>\n<td align=\"left\">\u63a5\u53e3<\/td>\n<td align=\"left\">\u9500\u6bc1\u65b9\u6cd5<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">destroy-method<\/td>\n<td align=\"left\">XML\/\u6ce8\u89e3<\/td>\n<td align=\"left\">\u9500\u6bc1\u65b9\u6cd5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u4e03\u3001\u5e38\u89c1\u95ee\u9898<\/h3>\n<p>1. &#064;PostConstruct \u5728\u4f9d\u8d56\u6ce8\u5165\u5b8c\u6210\u540e\u624d\u6267\u884c<\/p>\n<p>\u8fd9\u4e2a\u987a\u5e8f\u4fdd\u8bc1\u4e86 &#064;PostConstruct \u65b9\u6cd5\u4e2d\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u6ce8\u5165\u7684\u4f9d\u8d56&#xff0c;\u4e0d\u4f1a\u51fa\u73b0\u7a7a\u6307\u9488\u3002<\/p>\n<p><span class=\"token annotation punctuation\">&#064;PostConstruct<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">init<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    userDao<span class=\"token punctuation\">.<\/span><span class=\"token function\">count<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ \u5b89\u5168&#xff0c;userDao \u5df2\u7ecf\u88ab\u6ce8\u5165<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>2. AOP \u4ee3\u7406\u5728\u54ea\u4e2a\u9636\u6bb5\u751f\u6210&#xff1f;<\/p>\n<p>AOP \u4ee3\u7406\u5728 BeanPostProcessor.postProcessAfterInitialization() \u4e2d\u751f\u6210\u3002\u6240\u4ee5\u5982\u679c Bean \u88ab AOP \u4ee3\u7406&#xff0c;\u5bb9\u5668\u4e2d\u5b58\u653e\u7684\u662f\u4ee3\u7406\u5bf9\u8c61\u3002\u8fd9\u4e5f\u89e3\u91ca\u4e86\u4e3a\u4ec0\u4e48\u540c\u4e00\u4e2a\u7c7b\u5185\u90e8\u65b9\u6cd5\u8c03\u7528\u4e0d\u4f1a\u89e6\u53d1 AOP\u2014\u2014\u56e0\u4e3a\u5185\u90e8\u8c03\u7528\u8d70\u7684\u662f\u539f\u59cb\u5bf9\u8c61&#xff0c;\u4e0d\u662f\u4ee3\u7406\u5bf9\u8c61\u3002<\/p>\n<p>3. \u6784\u9020\u65b9\u6cd5\u4e2d\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u4f7f\u7528\u6ce8\u5165\u7684\u4f9d\u8d56&#xff1f;<\/p>\n<p>\u6784\u9020\u65b9\u6cd5\u6267\u884c\u65f6&#xff0c;\u5c5e\u6027\u586b\u5145\u8fd8\u6ca1\u5f00\u59cb\u3002\u6240\u4ee5\u6784\u9020\u65b9\u6cd5\u4e2d userDao \u8fd8\u662f null\u3002\u5982\u679c\u9700\u8981\u5728\u6784\u9020\u65b9\u6cd5\u4e2d\u4f7f\u7528\u4f9d\u8d56&#xff0c;\u5e94\u4f7f\u7528\u6784\u9020\u5668\u6ce8\u5165\u3002<\/p>\n<p>4. prototype Bean \u7684\u9500\u6bc1\u65b9\u6cd5\u4e3a\u4ec0\u4e48\u4e0d\u6267\u884c&#xff1f;<\/p>\n<p>Spring \u53ea\u8d1f\u8d23\u521b\u5efa prototype Bean&#xff0c;\u521b\u5efa\u5b8c\u6210\u540e\u5c31\u4e0d\u518d\u7ba1\u7406\u5b83\u7684\u751f\u547d\u5468\u671f\u3002\u9500\u6bc1\u65b9\u6cd5\u9700\u8981\u8c03\u7528\u65b9\u624b\u52a8\u8c03\u7528&#xff0c;\u6216\u8005\u901a\u8fc7 DisposableBeanAdapter \u81ea\u884c\u5904\u7406\u3002<\/p>\n<p>5. BeanPostProcessor \u4e3a\u4ec0\u4e48\u80fd\u62e6\u622a\u6240\u6709 Bean&#xff1f;<\/p>\n<p>BeanPostProcessor \u672c\u8eab\u4e5f\u662f\u4e00\u4e2a Bean&#xff0c;\u4f46\u5b83\u7684\u6ce8\u518c\u65f6\u673a\u975e\u5e38\u65e9&#xff08;\u5728 refresh() \u7684 registerBeanPostProcessors() \u9636\u6bb5&#xff09;\u3002Spring \u5728\u521b\u5efa\u4efb\u4f55 Bean \u65f6&#xff0c;\u90fd\u4f1a\u5148\u83b7\u53d6\u6240\u6709\u5df2\u6ce8\u518c\u7684 BeanPostProcessor&#xff0c;\u4f9d\u6b21\u8c03\u7528\u5b83\u4eec\u7684\u540e\u7f6e\u5904\u7406\u65b9\u6cd5\u3002<\/p>\n<h3>\u516b\u3001\u603b\u7ed3<\/h3>\n<p>Bean \u7684\u751f\u547d\u5468\u671f\u53ef\u4ee5\u6982\u62ec\u4e3a\u56db\u4e2a\u6838\u5fc3\u9636\u6bb5&#xff1a;\u5b9e\u4f8b\u5316 \u2192 \u5c5e\u6027\u586b\u5145 \u2192 \u521d\u59cb\u5316 \u2192 \u9500\u6bc1\u3002\u5728\u8fd9\u56db\u4e2a\u9636\u6bb5\u4e4b\u95f4&#xff0c;Spring \u63d0\u4f9b\u4e86\u591a\u4e2a\u6269\u5c55\u70b9&#xff0c;\u8ba9\u5f00\u53d1\u8005\u53ef\u4ee5\u5728\u5408\u9002\u7684\u65f6\u673a\u63d2\u5165\u81ea\u5b9a\u4e49\u903b\u8f91\u3002<\/p>\n<table>\n<tr>\u9636\u6bb5\u6838\u5fc3\u64cd\u4f5c\u5e38\u7528\u6269\u5c55\u70b9<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">\u5b9e\u4f8b\u5316<\/td>\n<td align=\"left\">\u53cd\u5c04\u8c03\u7528\u6784\u9020\u65b9\u6cd5<\/td>\n<td align=\"left\">InstantiationAwareBeanPostProcessor<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u5c5e\u6027\u586b\u5145<\/td>\n<td align=\"left\">\u4f9d\u8d56\u6ce8\u5165<\/td>\n<td align=\"left\">&#064;Autowired\u3001&#064;Value<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">Aware \u56de\u8c03<\/td>\n<td align=\"left\">\u83b7\u53d6\u5bb9\u5668\u8d44\u6e90<\/td>\n<td align=\"left\">BeanNameAware\u3001ApplicationContextAware<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u521d\u59cb\u5316\u524d<\/td>\n<td align=\"left\">BeanPostProcessor \u524d\u7f6e<\/td>\n<td align=\"left\">postProcessBeforeInitialization<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u521d\u59cb\u5316<\/td>\n<td align=\"left\">\u6267\u884c\u521d\u59cb\u5316\u903b\u8f91<\/td>\n<td align=\"left\">&#064;PostConstruct\u3001InitializingBean\u3001init-method<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u521d\u59cb\u5316\u540e<\/td>\n<td align=\"left\">BeanPostProcessor \u540e\u7f6e<\/td>\n<td align=\"left\">postProcessAfterInitialization&#xff08;AOP \u4ee3\u7406\u5728\u6b64\u751f\u6210&#xff09;<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u4f7f\u7528<\/td>\n<td align=\"left\">Bean \u5c31\u7eea<\/td>\n<td align=\"left\">\u2014<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u9500\u6bc1<\/td>\n<td align=\"left\">\u91ca\u653e\u8d44\u6e90<\/td>\n<td align=\"left\">&#064;PreDestroy\u3001DisposableBean\u3001destroy-method<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7406\u89e3 Bean \u751f\u547d\u5468\u671f&#xff0c;\u80fd\u5e2e\u4f60\u89e3\u91ca\u5f88\u591a Spring \u4e2d\u7684\u201c\u5947\u602a\u73b0\u8c61\u201d&#xff1a;\u4e3a\u4ec0\u4e48 &#064;PostConstruct \u80fd\u62ff\u5230\u6ce8\u5165\u7684\u4f9d\u8d56\u3001\u4e3a\u4ec0\u4e48 AOP \u4ee3\u7406\u7684\u65b9\u6cd5\u8c03\u7528\u6709\u201c\u81ea\u8c03\u7528\u5931\u6548\u201d\u95ee\u9898\u3001\u4e3a\u4ec0\u4e48 prototype Bean \u7684\u9500\u6bc1\u65b9\u6cd5\u4e0d\u751f\u6548\u3002\u638c\u63e1\u751f\u547d\u5468\u671f&#xff0c;\u5c31\u638c\u63e1\u4e86 Spring \u5bb9\u5668\u7ba1\u7406\u7684\u5e95\u5c42\u903b\u8f91\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Spring Bean \u7684\u751f\u547d\u5468\u671f\u8be6\u89e3<br \/>\n\u4e00\u3001\u4ec0\u4e48\u662f Bean \u7684\u751f\u547d\u5468\u671f&#xff1f;<br \/>\nBean \u7684\u751f\u547d\u5468\u671f\u662f\u6307\u4ece Spring \u5bb9\u5668\u521b\u5efa Bean \u5b9e\u4f8b\u5f00\u59cb&#xff0c;\u5230\u6700\u7ec8\u9500\u6bc1 Bean \u7684\u6574\u4e2a\u8fc7\u7a0b\u3002\u7406\u89e3\u8fd9\u4e2a\u8fc7\u7a0b&#xff0c;\u80fd\u5e2e\u4f60\u641e\u6e05\u695a\u5f88\u591a\u95ee\u9898&#xff1a;\u4e3a\u4ec0\u4e48 PostConstruct \u80fd\u5728\u4f9d\u8d56\u6ce8\u5165\u5b8c\u6210\u540e\u6267\u884c\u3001AOP \u4ee3\u7406\u662f\u5728\u54ea\u4e2a\u9636\u6bb5\u751f\u6210\u7684\u3001PreDestroy \u4e3a\u4ec0\u4e48\u6709\u65f6\u5019\u4e0d\u751f\u6548\u3002<br \/>\n\u4e8c\u3001\u5b8c\u6574\u751f\u547d\u5468\u671f\u6d41\u7a0b<br \/>\nSpring Bean \u7684\u751f\u547d\u5468\u671f\u53ef\u4ee5\u6982\u62ec\u4e3a\u56db\u4e2a<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,101,292],"topic":[],"class_list":["post-107297","post","type-post","status-publish","format-standard","hentry","category-server","tag-java","tag-spring","tag-292"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Spring Bean \u7684\u751f\u547d\u5468\u671f\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/107297.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring Bean \u7684\u751f\u547d\u5468\u671f\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"Spring Bean \u7684\u751f\u547d\u5468\u671f\u8be6\u89e3 \u4e00\u3001\u4ec0\u4e48\u662f Bean \u7684\u751f\u547d\u5468\u671f&#xff1f; Bean \u7684\u751f\u547d\u5468\u671f\u662f\u6307\u4ece Spring \u5bb9\u5668\u521b\u5efa Bean \u5b9e\u4f8b\u5f00\u59cb&#xff0c;\u5230\u6700\u7ec8\u9500\u6bc1 Bean \u7684\u6574\u4e2a\u8fc7\u7a0b\u3002\u7406\u89e3\u8fd9\u4e2a\u8fc7\u7a0b&#xff0c;\u80fd\u5e2e\u4f60\u641e\u6e05\u695a\u5f88\u591a\u95ee\u9898&#xff1a;\u4e3a\u4ec0\u4e48 PostConstruct \u80fd\u5728\u4f9d\u8d56\u6ce8\u5165\u5b8c\u6210\u540e\u6267\u884c\u3001AOP \u4ee3\u7406\u662f\u5728\u54ea\u4e2a\u9636\u6bb5\u751f\u6210\u7684\u3001PreDestroy \u4e3a\u4ec0\u4e48\u6709\u65f6\u5019\u4e0d\u751f\u6548\u3002 \u4e8c\u3001\u5b8c\u6574\u751f\u547d\u5468\u671f\u6d41\u7a0b Spring Bean \u7684\u751f\u547d\u5468\u671f\u53ef\u4ee5\u6982\u62ec\u4e3a\u56db\u4e2a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/107297.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-19T02:08:40+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/107297.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/107297.html\",\"name\":\"Spring Bean \u7684\u751f\u547d\u5468\u671f\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-19T02:08:40+00:00\",\"dateModified\":\"2026-09-19T02:08:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/107297.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/107297.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/107297.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Spring Bean \u7684\u751f\u547d\u5468\u671f\u8be6\u89e3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring Bean \u7684\u751f\u547d\u5468\u671f\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/107297.html","og_locale":"zh_CN","og_type":"article","og_title":"Spring Bean \u7684\u751f\u547d\u5468\u671f\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"Spring Bean \u7684\u751f\u547d\u5468\u671f\u8be6\u89e3 \u4e00\u3001\u4ec0\u4e48\u662f Bean \u7684\u751f\u547d\u5468\u671f&#xff1f; Bean \u7684\u751f\u547d\u5468\u671f\u662f\u6307\u4ece Spring \u5bb9\u5668\u521b\u5efa Bean \u5b9e\u4f8b\u5f00\u59cb&#xff0c;\u5230\u6700\u7ec8\u9500\u6bc1 Bean \u7684\u6574\u4e2a\u8fc7\u7a0b\u3002\u7406\u89e3\u8fd9\u4e2a\u8fc7\u7a0b&#xff0c;\u80fd\u5e2e\u4f60\u641e\u6e05\u695a\u5f88\u591a\u95ee\u9898&#xff1a;\u4e3a\u4ec0\u4e48 PostConstruct \u80fd\u5728\u4f9d\u8d56\u6ce8\u5165\u5b8c\u6210\u540e\u6267\u884c\u3001AOP \u4ee3\u7406\u662f\u5728\u54ea\u4e2a\u9636\u6bb5\u751f\u6210\u7684\u3001PreDestroy \u4e3a\u4ec0\u4e48\u6709\u65f6\u5019\u4e0d\u751f\u6548\u3002 \u4e8c\u3001\u5b8c\u6574\u751f\u547d\u5468\u671f\u6d41\u7a0b Spring Bean \u7684\u751f\u547d\u5468\u671f\u53ef\u4ee5\u6982\u62ec\u4e3a\u56db\u4e2a","og_url":"https:\/\/www.wsisp.com\/helps\/107297.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-19T02:08:40+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/107297.html","url":"https:\/\/www.wsisp.com\/helps\/107297.html","name":"Spring Bean \u7684\u751f\u547d\u5468\u671f\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-19T02:08:40+00:00","dateModified":"2026-09-19T02:08:40+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/107297.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/107297.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/107297.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Spring Bean \u7684\u751f\u547d\u5468\u671f\u8be6\u89e3"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/107297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=107297"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/107297\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=107297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=107297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=107297"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=107297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}