码迷,mamicode.com
首页 > 编程语言 > 详细

Spring中的BeanFactory和FactoryBean的区别

时间:2018-10-13 15:45:23      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:...   boolean   str   one   接口   OLE   row   区别   ssi   

一句话介绍

BeanFactory接口用来生产Bean,它处理生产bean的接口体系的最顶层,getBean方法可以获取bean。FactoryBean接口用来定制Bean的生产过程,getObject方法中可以实现自定义过程。

源码

BeanFactory源码 

public interface BeanFactory {
    String FACTORY_BEAN_PREFIX = "&";

    Object getBean(String var1) throws BeansException;

     T getBean(String var1, Class var2) throws BeansException;

     T getBean(Class var1) throws BeansException;

    Object getBean(String var1, Object... var2) throws BeansException;

     T getBean(Class var1, Object... var2) throws BeansException;

    boolean containsBean(String var1);

    boolean isSingleton(String var1) throws NoSuchBeanDefinitionException;

    boolean isPrototype(String var1) throws NoSuchBeanDefinitionException;

    boolean isTypeMatch(String var1, ResolvableType var2) throws NoSuchBeanDefinitionException;

    boolean isTypeMatch(String var1, Class var2) throws NoSuchBeanDefinitionException;

    Class getType(String var1) throws NoSuchBeanDefinitionException;

    String[] getAliases(String var1);
}

FactoryBean源码

public interface FactoryBean {
    T getObject() throws Exception;

    Class getObjectType();

    boolean isSingleton();
}

public interface FactoryBean {
    T getObject() throws Exception;

    Class getObjectType();

    boolean isSingleton();
}

 

Spring中的BeanFactory和FactoryBean的区别

标签:...   boolean   str   one   接口   OLE   row   区别   ssi   

原文地址:https://www.cnblogs.com/muxuanchan/p/9782833.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!