Skip to content

Commit 5aefb2c

Browse files
committed
refined javadoc (SPR-5789)
1 parent a06adf7 commit 5aefb2c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

org.springframework.beans/src/main/java/org/springframework/beans/factory/config/SingletonBeanRegistry.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2007 the original author or authors.
2+
* Copyright 2002-2009 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -40,7 +40,7 @@ public interface SingletonBeanRegistry {
4040
* call InitializingBean's <code>afterPropertiesSet</code> method).
4141
* The given instance will not receive any destruction callbacks
4242
* (like DisposableBean's <code>destroy</code> method) either.
43-
* <p>If running within a full BeanFactory: <b>Register a bean definition
43+
* <p>When running within a full BeanFactory: <b>Register a bean definition
4444
* instead of an existing instance if your bean is supposed to receive
4545
* initialization and/or destruction callbacks.</b>
4646
* <p>Typically invoked during registry configuration, but can also be used
@@ -62,6 +62,8 @@ public interface SingletonBeanRegistry {
6262
* <p>The main purpose of this method is to access manually registered singletons
6363
* (see {@link #registerSingleton}). Can also be used to access a singleton
6464
* defined by a bean definition that already been created, in a raw fashion.
65+
* <p><b>NOTE:</b> This lookup method is not aware of FactoryBean prefixes or aliases.
66+
* You need to resolve the canonical bean name first before obtaining the singleton instance.
6567
* @param beanName the name of the bean to look for
6668
* @return the registered singleton object, or <code>null</code> if none found
6769
* @see ConfigurableListableBeanFactory#getBeanDefinition
@@ -78,10 +80,12 @@ public interface SingletonBeanRegistry {
7880
* <p>To check whether a bean factory contains a bean definition with a given name,
7981
* use ListableBeanFactory's <code>containsBeanDefinition</code>. Calling both
8082
* <code>containsBeanDefinition</code> and <code>containsSingleton</code> answers
81-
* whether a specific bean factory contains an own bean with the given name.
83+
* whether a specific bean factory contains a local bean instance with the given name.
8284
* <p>Use BeanFactory's <code>containsBean</code> for general checks whether the
8385
* factory knows about a bean with a given name (whether manually registered singleton
8486
* instance or created by bean definition), also checking ancestor factories.
87+
* <p><b>NOTE:</b> This lookup method is not aware of FactoryBean prefixes or aliases.
88+
* You need to resolve the canonical bean name first before checking the singleton status.
8589
* @param beanName the name of the bean to look for
8690
* @return if this bean factory contains a singleton instance with the given name
8791
* @see #registerSingleton
@@ -95,9 +99,9 @@ public interface SingletonBeanRegistry {
9599
* <p>Only checks already instantiated singletons; does not return names
96100
* for singleton bean definitions which have not been instantiated yet.
97101
* <p>The main purpose of this method is to check manually registered singletons
98-
* (see {@link #registerSingleton}). Can also be used to check which
99-
* singletons defined by a bean definition have already been created.
100-
* @return the list of names as String array (never <code>null</code>)
102+
* (see {@link #registerSingleton}). Can also be used to check which singletons
103+
* defined by a bean definition have already been created.
104+
* @return the list of names as a String array (never <code>null</code>)
101105
* @see #registerSingleton
102106
* @see org.springframework.beans.factory.support.BeanDefinitionRegistry#getBeanDefinitionNames
103107
* @see org.springframework.beans.factory.ListableBeanFactory#getBeanDefinitionNames

0 commit comments

Comments
 (0)