有關(guān)spring中的factorybean的深刻理解

          Interface to be implemented by objects used within a BeanFactory that are themselves factories. If a bean implements this interface, it is used as a factory, not directly as a bean.

          NB: A bean that implements this interface cannot be used as a normal bean. A FactoryBean is defined in a bean style, but the object exposed for bean references is always the object that it creates.

          FactoryBeans can support singletons and prototypes, and can either create objects lazily on demand or eagerly on startup.

          This interface is heavily used within the framework, for example for the AOP ProxyFactoryBean or JndiObjectFactoryBean. It can be used for application components, but this is not common outside of infrastructure code.


          可以自己創(chuàng)建FactoryBean,這個時候的類就要當(dāng)做工廠類來使用。在spring的配置文件中<ref local="factoryBean"/>調(diào)用的是getObject()方法,返回是object對象。


          posted on 2007-12-25 15:01 劉錚 閱讀(330) 評論(0)  編輯  收藏 所屬分類: Spring

          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          導(dǎo)航

          統(tǒng)計

          留言簿(1)

          文章分類(141)

          文章檔案(147)

          搜索

          最新評論

          主站蜘蛛池模板: 封开县| 静宁县| 宁远县| 麟游县| 大渡口区| 吉木萨尔县| 临城县| 体育| 濮阳市| 河东区| 英超| 阿鲁科尔沁旗| 宾川县| 申扎县| 新龙县| 饶平县| 闽清县| 福鼎市| 吉林市| 衡山县| 宝丰县| 郎溪县| 陈巴尔虎旗| 丰县| 建德市| 时尚| 高台县| 宿松县| 平阳县| 温宿县| 瑞安市| 禄劝| 宁都县| 内江市| 湾仔区| 溧水县| 许昌市| 瑞昌市| 南部县| 英德市| 安化县|