一句话介绍
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(); }
原文地址:https://www.cnblogs.com/muxuanchan/p/9782833.html
时间: 2024-09-30 11:29:02