Spring之FactoryBean

介紹

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();


參考文檔:

  1. https://blog.51cto.com/4247649/2118353
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章