Spring源碼解析之BeanFactory
阿新 • • 發佈:2019-02-26
args obj ads acl check rgs beans span col
BeanFactory接口:
用於訪問SpringBean容器的根接口,這個接口是由持有許多bean定義的對象實現的,每個定義都由一個字符串名稱唯一標識。根據bean定義,工廠將返回包含對象的獨立實例(原型設計模式)或單個共享實例(與工廠範圍內的單例實例為單例的單例設計模式相比,這是一種更好的選擇)。BeanFactory是應用程序組件的中心註冊表,並集中應用程序組件的配置。
String[] |
getAliases(String name) Return the aliases for the given bean name, if any. |
|
|
getBean(Class<T> requiredType) Return the bean instance that uniquely matches the given object type, if any. |
|
Object |
getBean(String name) Return an instance, which may be shared or independent, of the specified bean. | |
|
getBean(String name, Class<T> requiredType) Return an instance, which may be shared or independent, of the specified bean. |
|
Object |
getBean(String name, Object... args) Return an instance, which may be shared or independent, of the specified bean. | |
Class<?> |
getType(String name) Determine the type of the bean with the given name. |
|
boolean |
isPrototype(String name) Is this bean a prototype? That is, will getBean(java.lang.String) always return independent instances? |
|
boolean |
isSingleton(String name) Is this bean a shared singleton? That is, will getBean(java.lang.String) always return the same instance? |
|
boolean |
isTypeMatch(String name, Class<?> targetType) Check whether the bean with the given name matches the specified type. |
Spring源碼解析之BeanFactory