{"id":419,"date":"2023-10-28T17:24:38","date_gmt":"2023-10-28T09:24:38","guid":{"rendered":"https:\/\/www.talktop.cn\/?p=419"},"modified":"2025-01-01T22:31:08","modified_gmt":"2025-01-01T14:31:08","slug":"%e6%b7%b1%e5%85%a5spring%e6%a1%86%e6%9e%b6%ef%bc%9abean%e7%9a%84%e7%94%9f%e5%91%bd%e5%91%a8%e6%9c%9f%e4%b8%8e%e7%ae%a1%e7%90%86","status":"publish","type":"post","link":"https:\/\/www.talktop.cn\/?p=419","title":{"rendered":"\u6df1\u5165Spring\u6846\u67b6\uff1aBean\u7684\u751f\u547d\u5468\u671f\u4e0e\u7ba1\u7406"},"content":{"rendered":"\n<p>Spring\u6846\u67b6\u662fJava\u5f00\u53d1\u9886\u57df\u4e2d\u5e7f\u6cdb\u4f7f\u7528\u7684\u6846\u67b6\uff0c\u4e3b\u8981\u8d1f\u8d23\u7b80\u5316\u4f01\u4e1a\u7ea7\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\u3002Spring\u6846\u67b6\u7684\u6838\u5fc3\u662fBean\u5bb9\u5668\uff0c\u5b83\u8d1f\u8d23\u7ba1\u7406\u5e94\u7528\u7a0b\u5e8f\u7684\u5bf9\u8c61\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u6df1\u5165\u63a2\u8ba8Spring\u4e2dBean\u7684\u751f\u547d\u5468\u671f\u3001\u7c7b\u578b\uff0c\u4ee5\u53ca\u5982\u4f55\u88ab\u521b\u5efa\u3001\u7ba1\u7406\u548c\u9500\u6bc1\u3002<\/p>\n\n\n\n<p><strong>\u4e00\u3001Bean\u7684\u5b9a\u4e49\u4e0e\u7c7b\u578b<\/strong><\/p>\n\n\n\n<p>\u5b9a\u4e49:\u5728Spring\u4e2d\uff0cBean\u662f\u7531Spring IOC\u5bb9\u5668\u5b9e\u4f8b\u5316\u3001\u7ec4\u88c5\u548c\u7ba1\u7406\u7684\u5bf9\u8c61\u3002Beans\u662fSpring\u5e94\u7528\u7a0b\u5e8f\u7684\u4e3b\u8981\u7ec4\u6210\u90e8\u5206\uff0c\u5b83\u4eec\u4ece\u914d\u7f6e\u5143\u6570\u636e\u4e2d\u83b7\u53d6\u914d\u7f6e\u548c\u72b6\u6001\u3002<\/p>\n\n\n\n<p>\u7c7b\u578b:Spring\u6846\u67b6\u652f\u6301\u591a\u79cd\u7c7b\u578b\u7684Beans\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e9b\u4e3b\u8981\u7684Bean\u7c7b\u578b\uff1a<\/p>\n\n\n\n<p>Singleton:\u6b64\u7c7b\u578b\u7684Bean\u5728Spring IOC\u5bb9\u5668\u4e2d\u53ea\u6709\u4e00\u4e2a\u5b9e\u4f8b\u3002\u6bcf\u6b21\u8bf7\u6c42\u76f8\u540c\u7684Bean\u90fd\u4f1a\u8fd4\u56de\u76f8\u540c\u7684\u5b9e\u4f8b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>@Bean\n@Scope(\"singleton\")\npublic MyBean singletonBean() {\n    return new MyBean();\n}<\/code><\/pre>\n\n\n\n<p>Prototype:\u6b64\u7c7b\u578b\u7684Bean\u6bcf\u6b21\u8bf7\u6c42\u65f6\u90fd\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5b9e\u4f8b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>@Bean\n@Scope(\"prototype\")\npublic MyBean prototypeBean() {\n    return new MyBean();\n}<\/code><\/pre>\n\n\n\n<p>Request Scope:\u5728Web\u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u6bcf\u4e2aHTTP\u8bf7\u6c42\u90fd\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Bean\u5b9e\u4f8b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>@Scope(\"request\")\n@Bean\npublic MyBean requestScopedBean() {\n&nbsp;&nbsp;&nbsp;&nbsp;return new MyBean();\n}<\/code><\/pre>\n\n\n\n<p>Session Scope:\u5728Web\u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u6bcf\u4e2aHTTP\u4f1a\u8bdd\u90fd\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Bean\u5b9e\u4f8b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>@Scope(\"session\")\n@Bean\npublic MyBean sessionScopedBean() {\n    return new MyBean();\n}<\/code><\/pre>\n\n\n\n<p>Application Scope:\u5bf9\u4e8e\u6574\u4e2aWeb\u5e94\u7528\u7a0b\u5e8f\uff0c\u53ea\u521b\u5efa\u4e00\u4e2aBean\u5b9e\u4f8b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>@Scope(\"application\")\n@Bean\npublic MyBean applicationScopedBean() {\n    return new MyBean();\n}<\/code><\/pre>\n\n\n\n<p>WebSocket Scope:\u5728WebSocket\u751f\u547d\u5468\u671f\u4e2d\uff0c\u6bcf\u4e2aWebSocket\u4f1a\u8bdd\u90fd\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Bean\u5b9e\u4f8b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>@Scope(\"websocket\")\n@Bean\npublic MyBean websocketScopedBean() {\n    return new MyBean();\n}<\/code><\/pre>\n\n\n\n<p><strong>\u4e8c\u3001Bean\u7684\u521b\u5efa\u8fc7\u7a0b<\/strong><\/p>\n\n\n\n<p>Bean\u7684\u521b\u5efa\u8fc7\u7a0b\u4e3b\u8981\u5206\u4e3a\u51e0\u4e2a\u9636\u6bb5\uff1a<\/p>\n\n\n\n<p>\u8bfb\u53d6\u914d\u7f6e\u6587\u4ef6:Spring\u9996\u5148\u9700\u8981\u8bfb\u53d6\u914d\u7f6e\u6587\u4ef6\uff08\u53ef\u4ee5\u662fXML\u914d\u7f6e\u6587\u4ef6\u6216\u4f7f\u7528Java\u6ce8\u89e3\u7684\u914d\u7f6e\uff09\u6765\u83b7\u53d6Bean\u7684\u5b9a\u4e49\u548c\u5c5e\u6027\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>\/\/ \u4e3e\u4f8b: \u4f7f\u7528Java\u6ce8\u89e3\u914d\u7f6e\n@Configuration\npublic class AppConfig {\n    @Bean\n    public MyBean myBean() {\n        return new MyBean();\n    }\n}<\/code><\/pre>\n\n\n\n<p>\u89e3\u6790\u914d\u7f6e\u6587\u4ef6:Spring\u89e3\u6790\u914d\u7f6e\u6587\u4ef6\u5e76\u5c06Bean\u5b9a\u4e49\u52a0\u8f7d\u5230BeanFactory\u4e2d\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>\/\/ AbstractBeanDefinitionReader.java\npublic int loadBeanDefinitions(Resource... resources) throws BeanDefinitionStoreException {\n    \/\/ ...\n    for (Resource resource : resources) {\n        loadBeanDefinitions(new EncodedResource(resource));\n    }\n    \/\/ ...\n}<\/code><\/pre>\n\n\n\n<p>\u5b9e\u4f8b\u5316Bean:Spring\u5bb9\u5668\u4f1a\u5b9e\u4f8b\u5316Bean\uff0c\u5e76\u4e3a\u5176\u5206\u914d\u5185\u5b58\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>\/\/ AbstractAutowireCapableBeanFactory.java\nprotected Object createBean(String beanName, RootBeanDefinition mbd, @Nullable Object&#91;] args)\n        throws BeanCreationException {\n    \/\/ Instantiate the bean...\n    BeanWrapper instanceWrapper = createBeanInstance(beanName, mbd, args);\n}<\/code><\/pre>\n\n\n\n<p>\u4f9d\u8d56\u6ce8\u5165:Spring\u5bb9\u5668\u4f1a\u89e3\u6790Bean\u7684\u4f9d\u8d56\u5173\u7cfb\uff0c\u5e76\u5c06\u6240\u9700\u7684\u4f9d\u8d56\u6ce8\u5165\u5230Bean\u4e2d\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>\/\/ AbstractAutowireCapableBeanFactory.java\nprotected void populateBean(String beanName, RootBeanDefinition mbd, @Nullable BeanWrapper bw) {\n    \/\/ Inject dependencies...\n    doResolveDependency(descriptor, beanName, autowiredBeanNames, typeConverter);\n}<\/code><\/pre>\n\n\n\n<p>\u521d\u59cb\u5316Bean:Spring\u5bb9\u5668\u4f1a\u8c03\u7528Bean\u7684\u521d\u59cb\u5316\u65b9\u6cd5\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>\/\/ AbstractAutowireCapableBeanFactory.java\nprotected Object initializeBean(String beanName, Object bean, @Nullable RootBeanDefinition mbd) {\n    \/\/ Initialize the bean...\n    invokeInitMethods(beanName, wrappedBean, mbd);\n}<\/code><\/pre>\n\n\n\n<p><strong>\u4e09\u3001 Spring\u7684\u4e09\u5c42\u7f13\u5b58<\/strong><\/p>\n\n\n\n<p>\u4e3a\u4e86\u89e3\u51b3\u5faa\u73af\u4f9d\u8d56\u7684\u95ee\u9898\uff0cSpring\u5f15\u5165\u4e86\u4e09\u5c42\u7f13\u5b58\u673a\u5236\uff1a<\/p>\n\n\n\n<p>\u4e00\u7ea7\u7f13\u5b58\uff08Singleton Objects\uff09: \u5b58\u50a8\u5b8c\u5168\u521d\u59cb\u5316\u7684Bean\u3002<\/p>\n\n\n\n<p>\u4e8c\u7ea7\u7f13\u5b58\uff08Early Singleton Objects\uff09: \u5b58\u50a8\u65e9\u671f\u66b4\u9732\u7684Bean\uff0c\u4e3b\u8981\u7528\u4e8e\u89e3\u51b3\u5faa\u73af\u4f9d\u8d56\u95ee\u9898\u3002<\/p>\n\n\n\n<p>\u4e09\u7ea7\u7f13\u5b58\uff08Singleton Factories\uff09: \u5b58\u50a8Bean\u5de5\u5382\u5bf9\u8c61\uff0c\u7528\u4e8e\u521b\u5efaBean\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>\/\/ DefaultSingletonBeanRegistry.java\nprotected void addSingletonFactory(String beanName, ObjectFactory&lt;?&gt; singletonFactory) {\n    \/\/ ...\n    this.singletonFactories.put(beanName, singletonFactory);\n    this.earlySingletonObjects.remove(beanName);\n    this.registeredSingletons.add(beanName);\n}<\/code><\/pre>\n\n\n\n<p><strong>\u56db\u3001Bean\u5faa\u73af\u4f9d\u8d56\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n\n\n\n<p>\u5faa\u73af\u4f9d\u8d56\u662f\u6307\u4e24\u4e2a\u6216\u591a\u4e2aBean\u4e92\u76f8\u4f9d\u8d56\u7684\u60c5\u51b5\u3002\u4f8b\u5982\uff0cBean A\u4f9d\u8d56Bean B\uff0c\u800cBean B\u4f9d\u8d56Bean A\u3002Spring\u6846\u67b6\u901a\u8fc7\u63d0\u524d\u66b4\u9732Bean\u548c\u4e09\u5c42\u7f13\u5b58\u673a\u5236\u6765\u89e3\u51b3\u5faa\u73af\u4f9d\u8d56\u7684\u95ee\u9898\u3002<\/p>\n\n\n\n<p>\u89e3\u51b3\u65b9\u6cd5:\u4f7f\u7528\u6784\u9020\u5668\u6ce8\u5165\u53ef\u4ee5\u89e3\u51b3\u5faa\u73af\u4f9d\u8d56\u7684\u95ee\u9898\u3002\u5f53\u4f7f\u7528\u6784\u9020\u5668\u6ce8\u5165\u65f6\uff0cSpring\u5bb9\u5668\u53ef\u4ee5\u5728\u4e00\u4e2aBean\u5b8c\u5168\u521d\u59cb\u5316\u4e4b\u540e\u5904\u7406\u5176\u4ed6\u7684Bean\uff0c\u4ece\u800c\u907f\u514d\u4e86\u5faa\u73af\u4f9d\u8d56\u7684\u95ee\u9898\u3002<\/p>\n\n\n\n<p>\u793a\u4f8b:\u5047\u8bbe\u6211\u4eec\u6709\u4e24\u4e2aBean\uff0cBean A\u548cBean B\uff0c\u5b83\u4eec\u4e92\u76f8\u4f9d\u8d56<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>@Component\npublic class BeanA {\n    private final BeanB beanB;\n\n    @Autowired\n    public BeanA(BeanB beanB) {\n        this.beanB = beanB;\n    }\n}\n\n@Component\npublic class BeanB {\n    private final BeanA beanA;\n\n    @Autowired\n    public BeanB(BeanA beanA) {\n        this.beanA = beanA;\n    }\n}\n\n<\/code><\/pre>\n\n\n\n<p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u901a\u8fc7\u6784\u9020\u5668\u6ce8\u5165\uff0cSpring\u80fd\u591f\u6210\u529f\u5730\u89e3\u51b3Bean A\u548cBean B\u4e4b\u95f4\u7684\u5faa\u73af\u4f9d\u8d56\u95ee\u9898\u3002<\/p>\n\n\n\n<p><strong>\u4e94\u3001Bean\u7684\u6ce8\u5165\u65b9\u5f0f<\/strong><\/p>\n\n\n\n<p>Spring\u63d0\u4f9b\u4e86\u51e0\u79cd\u4e0d\u540c\u7684Bean\u6ce8\u5165\u65b9\u5f0f\uff1a Setter\u6ce8\u5165: \u901a\u8fc7setter\u65b9\u6cd5\u6ce8\u5165\u4f9d\u8d56\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>public class MyBean {\n    private AnotherBean anotherBean;\n\n    public void setAnotherBean(AnotherBean anotherBean) {\n        this.anotherBean = anotherBean;\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>\u6784\u9020\u5668\u6ce8\u5165: \u901a\u8fc7\u6784\u9020\u5668\u53c2\u6570\u6ce8\u5165\u4f9d\u8d56\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>public class MyBean {\n    private AnotherBean anotherBean;\n\n    public MyBean(AnotherBean anotherBean) {\n        this.anotherBean = anotherBean;\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>\u5b57\u6bb5\u6ce8\u5165: \u76f4\u63a5\u5728\u5b57\u6bb5\u4e0a\u6ce8\u5165\u4f9d\u8d56\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>public class MyBean {\n    @Autowired\n    private AnotherBean anotherBean;\n}\n<\/code><\/pre>\n\n\n\n<p>\u65b9\u6cd5\u6ce8\u5165: \u901a\u8fc7\u65b9\u6cd5\u53c2\u6570\u6ce8\u5165\u4f9d\u8d56\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>public class MyBean {\n    private AnotherBean anotherBean;\n\n    @Autowired\n    public void anyMethodName(AnotherBean anotherBean) {\n        this.anotherBean = anotherBean;\n    }\n}<\/code><\/pre>\n\n\n\n<p><strong>\u516d\u3001 \u5176\u4ed6\u76f8\u5173\u6982\u5ff5<\/strong><\/p>\n\n\n\n<p>FactoryBean\u548cServiceLocatorFactoryBean:<\/p>\n\n\n\n<p>Spring\u8fd8\u63d0\u4f9b\u4e86FactoryBean\u548cServiceLocatorFactoryBean\u7b49\u9ad8\u7ea7Bean\u7c7b\u578b\uff0c\u4ee5\u652f\u6301\u66f4\u590d\u6742\u7684\u914d\u7f6e\u548c\u521d\u59cb\u5316\u903b\u8f91\u3002<\/p>\n\n\n\n<p>AOP\uff08Aspect-Oriented Programming\uff09\u4e0eBean\u7684\u751f\u547d\u5468\u671f:<\/p>\n\n\n\n<p>Spring\u7684AOP\u6846\u67b6\u4e5f\u4f1a\u5f71\u54cdBean\u7684\u751f\u547d\u5468\u671f\uff0c\u7279\u522b\u662f\u5728\u521b\u5efa\u548c\u521d\u59cb\u5316Bean\u65f6\u3002<\/p>\n\n\n\n<p>BeanPostProcessor:<\/p>\n\n\n\n<p>BeanPostProcessor\u63a5\u53e3\u5141\u8bb8\u5728Bean\u7684\u751f\u547d\u5468\u671f\u7684\u7279\u5b9a\u70b9\u6267\u884c\u81ea\u5b9a\u4e49\u903b\u8f91\u3002<\/p>\n\n\n\n<p><strong>\u7ed3\u8bba<\/strong><\/p>\n\n\n\n<p>\u901a\u8fc7\u6df1\u5165\u4e86\u89e3Spring\u6846\u67b6\u4e2d\u7684Bean\u751f\u547d\u5468\u671f\u548c\u7ba1\u7406\u673a\u5236\uff0c\u6211\u4eec\u80fd\u591f\u66f4\u597d\u5730\u7406\u89e3\u548c\u638c\u63e1Spring\u6846\u67b6\u7684\u6838\u5fc3\u6982\u5ff5\uff0c\u4e3a\u6784\u5efa\u9ad8\u6548\u3001\u53ef\u7ef4\u62a4\u7684\u4f01\u4e1a\u7ea7\u5e94\u7528\u7a0b\u5e8f\u5960\u5b9a\u575a\u5b9e\u7684\u57fa\u7840\u3002\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u9879\u76ee\u7684\u5b9e\u9645\u9700\u6c42\u548c\u573a\u666f\uff0c\u9009\u62e9\u9002\u5f53\u7684Bean\u7c7b\u578b\u548c\u914d\u7f6e\uff0c\u4ee5\u786e\u4fdd\u5e94\u7528\u7a0b\u5e8f\u7684\u7a33\u5b9a\u6027\u548c\u53ef\u6269\u5c55\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Spring\u6846\u67b6\u662fJava\u5f00\u53d1\u9886\u57df\u4e2d\u5e7f\u6cdb\u4f7f\u7528\u7684\u6846\u67b6\uff0c\u4e3b\u8981\u8d1f\u8d23\u7b80\u5316\u4f01\u4e1a\u7ea7\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\u3002Spring\u6846\u67b6\u7684\u6838\u5fc3\u662f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[118,59],"tags":[16],"class_list":["post-419","post","type-post","status-publish","format-standard","hentry","category-118","category-59","tag-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u6df1\u5165Spring\u6846\u67b6\uff1aBean\u7684\u751f\u547d\u5468\u671f\u4e0e\u7ba1\u7406<\/title>\n<meta name=\"description\" content=\"Spring\u6846\u67b6\u662fJava\u5f00\u53d1\u9886\u57df\u4e2d\u5e7f\u6cdb\u4f7f\u7528\u7684\u6846\u67b6\uff0c\u4e3b\u8981\u8d1f\u8d23\u7b80\u5316\u4f01\u4e1a\u7ea7\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\u3002Spring\u6846\u67b6\u7684\u6838\u5fc3\u662fBean\u5bb9\u5668\uff0c\u5b83\u8d1f\u8d23\u7ba1\u7406\u5e94\u7528\u7a0b\u5e8f\u7684\u5bf9\u8c61\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u6df1\u5165\u63a2\u8ba8Spring\u4e2dBean\u7684\u751f\u547d\u5468\u671f\u3001\u7c7b\u578b\uff0c\u4ee5\u53ca\u5982\u4f55\u88ab\u521b\u5efa\u3001\u7ba1\u7406\u548c\u9500\u6bc1\u3002\" \/>\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.talktop.cn\/?p=419\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.talktop.cn\/?p=419#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.talktop.cn\/?p=419\"},\"author\":{\"name\":\"AI\u98ce\u5411\u6807\",\"@id\":\"https:\/\/www.talktop.cn\/#\/schema\/person\/25908db5f654913a22bc38d48fad71ab\"},\"headline\":\"\u6df1\u5165Spring\u6846\u67b6\uff1aBean\u7684\u751f\u547d\u5468\u671f\u4e0e\u7ba1\u7406\",\"datePublished\":\"2023-10-28T09:24:38+00:00\",\"dateModified\":\"2025-01-01T14:31:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.talktop.cn\/?p=419\"},\"wordCount\":126,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.talktop.cn\/#\/schema\/person\/25908db5f654913a22bc38d48fad71ab\"},\"keywords\":[\"\u7f16\u7a0b\"],\"articleSection\":[\"\u540e\u7aef\u5f00\u53d1\",\"\u7f16\u7a0b\u6280\u672f\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.talktop.cn\/?p=419#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.talktop.cn\/?p=419\",\"url\":\"https:\/\/www.talktop.cn\/?p=419\",\"name\":\"\u6df1\u5165Spring\u6846\u67b6\uff1aBean\u7684\u751f\u547d\u5468\u671f\u4e0e\u7ba1\u7406\",\"isPartOf\":{\"@id\":\"https:\/\/www.talktop.cn\/#website\"},\"datePublished\":\"2023-10-28T09:24:38+00:00\",\"dateModified\":\"2025-01-01T14:31:08+00:00\",\"description\":\"Spring\u6846\u67b6\u662fJava\u5f00\u53d1\u9886\u57df\u4e2d\u5e7f\u6cdb\u4f7f\u7528\u7684\u6846\u67b6\uff0c\u4e3b\u8981\u8d1f\u8d23\u7b80\u5316\u4f01\u4e1a\u7ea7\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\u3002Spring\u6846\u67b6\u7684\u6838\u5fc3\u662fBean\u5bb9\u5668\uff0c\u5b83\u8d1f\u8d23\u7ba1\u7406\u5e94\u7528\u7a0b\u5e8f\u7684\u5bf9\u8c61\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u6df1\u5165\u63a2\u8ba8Spring\u4e2dBean\u7684\u751f\u547d\u5468\u671f\u3001\u7c7b\u578b\uff0c\u4ee5\u53ca\u5982\u4f55\u88ab\u521b\u5efa\u3001\u7ba1\u7406\u548c\u9500\u6bc1\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.talktop.cn\/?p=419#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.talktop.cn\/?p=419\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.talktop.cn\/?p=419#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.talktop.cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6df1\u5165Spring\u6846\u67b6\uff1aBean\u7684\u751f\u547d\u5468\u671f\u4e0e\u7ba1\u7406\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.talktop.cn\/#website\",\"url\":\"https:\/\/www.talktop.cn\/\",\"name\":\"AI\u98ce\u5411\u6807\",\"description\":\"ChatGPT \u4eba\u5de5\u667a\u80fd \u7f16\u7a0b\u6280\u672f AIGC \u540e\u7aef\u6280\u672f \u524d\u7aef\u6280\u672f \u70ed\u95e8\u63d2\u4ef6 \u8fd0\u8425\u76f8\u5173 ChatGPT\u8ba2\u9605 Claude\u5145\u503c \u6d77\u5916\u5145\u503c \u8c37\u6b4c\u90ae\u7bb1\",\"publisher\":{\"@id\":\"https:\/\/www.talktop.cn\/#\/schema\/person\/25908db5f654913a22bc38d48fad71ab\"},\"alternateName\":\"AI\u98ce\u5411\u6807\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.talktop.cn\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.talktop.cn\/#\/schema\/person\/25908db5f654913a22bc38d48fad71ab\",\"name\":\"AI\u98ce\u5411\u6807\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.talktop.cn\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.talktop.cn\/wp-content\/uploads\/2023\/10\/cropped-f09060ba975518b80d3b0b63b47108a6.jpeg\",\"contentUrl\":\"https:\/\/www.talktop.cn\/wp-content\/uploads\/2023\/10\/cropped-f09060ba975518b80d3b0b63b47108a6.jpeg\",\"width\":512,\"height\":512,\"caption\":\"AI\u98ce\u5411\u6807\"},\"logo\":{\"@id\":\"https:\/\/www.talktop.cn\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u6df1\u5165Spring\u6846\u67b6\uff1aBean\u7684\u751f\u547d\u5468\u671f\u4e0e\u7ba1\u7406","description":"Spring\u6846\u67b6\u662fJava\u5f00\u53d1\u9886\u57df\u4e2d\u5e7f\u6cdb\u4f7f\u7528\u7684\u6846\u67b6\uff0c\u4e3b\u8981\u8d1f\u8d23\u7b80\u5316\u4f01\u4e1a\u7ea7\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\u3002Spring\u6846\u67b6\u7684\u6838\u5fc3\u662fBean\u5bb9\u5668\uff0c\u5b83\u8d1f\u8d23\u7ba1\u7406\u5e94\u7528\u7a0b\u5e8f\u7684\u5bf9\u8c61\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u6df1\u5165\u63a2\u8ba8Spring\u4e2dBean\u7684\u751f\u547d\u5468\u671f\u3001\u7c7b\u578b\uff0c\u4ee5\u53ca\u5982\u4f55\u88ab\u521b\u5efa\u3001\u7ba1\u7406\u548c\u9500\u6bc1\u3002","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.talktop.cn\/?p=419","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.talktop.cn\/?p=419#article","isPartOf":{"@id":"https:\/\/www.talktop.cn\/?p=419"},"author":{"name":"AI\u98ce\u5411\u6807","@id":"https:\/\/www.talktop.cn\/#\/schema\/person\/25908db5f654913a22bc38d48fad71ab"},"headline":"\u6df1\u5165Spring\u6846\u67b6\uff1aBean\u7684\u751f\u547d\u5468\u671f\u4e0e\u7ba1\u7406","datePublished":"2023-10-28T09:24:38+00:00","dateModified":"2025-01-01T14:31:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.talktop.cn\/?p=419"},"wordCount":126,"commentCount":0,"publisher":{"@id":"https:\/\/www.talktop.cn\/#\/schema\/person\/25908db5f654913a22bc38d48fad71ab"},"keywords":["\u7f16\u7a0b"],"articleSection":["\u540e\u7aef\u5f00\u53d1","\u7f16\u7a0b\u6280\u672f"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.talktop.cn\/?p=419#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.talktop.cn\/?p=419","url":"https:\/\/www.talktop.cn\/?p=419","name":"\u6df1\u5165Spring\u6846\u67b6\uff1aBean\u7684\u751f\u547d\u5468\u671f\u4e0e\u7ba1\u7406","isPartOf":{"@id":"https:\/\/www.talktop.cn\/#website"},"datePublished":"2023-10-28T09:24:38+00:00","dateModified":"2025-01-01T14:31:08+00:00","description":"Spring\u6846\u67b6\u662fJava\u5f00\u53d1\u9886\u57df\u4e2d\u5e7f\u6cdb\u4f7f\u7528\u7684\u6846\u67b6\uff0c\u4e3b\u8981\u8d1f\u8d23\u7b80\u5316\u4f01\u4e1a\u7ea7\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\u3002Spring\u6846\u67b6\u7684\u6838\u5fc3\u662fBean\u5bb9\u5668\uff0c\u5b83\u8d1f\u8d23\u7ba1\u7406\u5e94\u7528\u7a0b\u5e8f\u7684\u5bf9\u8c61\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u6df1\u5165\u63a2\u8ba8Spring\u4e2dBean\u7684\u751f\u547d\u5468\u671f\u3001\u7c7b\u578b\uff0c\u4ee5\u53ca\u5982\u4f55\u88ab\u521b\u5efa\u3001\u7ba1\u7406\u548c\u9500\u6bc1\u3002","breadcrumb":{"@id":"https:\/\/www.talktop.cn\/?p=419#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.talktop.cn\/?p=419"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.talktop.cn\/?p=419#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.talktop.cn\/"},{"@type":"ListItem","position":2,"name":"\u6df1\u5165Spring\u6846\u67b6\uff1aBean\u7684\u751f\u547d\u5468\u671f\u4e0e\u7ba1\u7406"}]},{"@type":"WebSite","@id":"https:\/\/www.talktop.cn\/#website","url":"https:\/\/www.talktop.cn\/","name":"AI\u98ce\u5411\u6807","description":"ChatGPT \u4eba\u5de5\u667a\u80fd \u7f16\u7a0b\u6280\u672f AIGC \u540e\u7aef\u6280\u672f \u524d\u7aef\u6280\u672f \u70ed\u95e8\u63d2\u4ef6 \u8fd0\u8425\u76f8\u5173 ChatGPT\u8ba2\u9605 Claude\u5145\u503c \u6d77\u5916\u5145\u503c \u8c37\u6b4c\u90ae\u7bb1","publisher":{"@id":"https:\/\/www.talktop.cn\/#\/schema\/person\/25908db5f654913a22bc38d48fad71ab"},"alternateName":"AI\u98ce\u5411\u6807","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.talktop.cn\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/www.talktop.cn\/#\/schema\/person\/25908db5f654913a22bc38d48fad71ab","name":"AI\u98ce\u5411\u6807","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.talktop.cn\/#\/schema\/person\/image\/","url":"https:\/\/www.talktop.cn\/wp-content\/uploads\/2023\/10\/cropped-f09060ba975518b80d3b0b63b47108a6.jpeg","contentUrl":"https:\/\/www.talktop.cn\/wp-content\/uploads\/2023\/10\/cropped-f09060ba975518b80d3b0b63b47108a6.jpeg","width":512,"height":512,"caption":"AI\u98ce\u5411\u6807"},"logo":{"@id":"https:\/\/www.talktop.cn\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/\/"]}]}},"_links":{"self":[{"href":"https:\/\/www.talktop.cn\/index.php?rest_route=\/wp\/v2\/posts\/419","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.talktop.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.talktop.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.talktop.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.talktop.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=419"}],"version-history":[{"count":0,"href":"https:\/\/www.talktop.cn\/index.php?rest_route=\/wp\/v2\/posts\/419\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.talktop.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.talktop.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.talktop.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}