欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Spring之FactoryBean

程序员文章站 2022-05-23 18:06:02
...

介绍

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
相关标签: FactoryBean Spring