介紹
FactoryBean是用來構造Bean的接口。
源碼
package org.springframework.beans.factory;
public interface FactoryBean<T> {
/**
* Return an instance (possibly shared or independent) of the object
* managed by this factory.
* 返回由FactoryBean管理的對象實例
*/
T getObject() throws Exception;
/**
* Return the type of object that this FactoryBean creates,
* or {@code null} if not known in advance.
* 返回對象實例的類型
*/
Class<?> getObjectType();
/**
* Is the object managed by this factory a singleton?
*/
boolean isSingleton();
參考文檔: