File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
spring-beans/src/main/java/org/springframework/beans/factory/config Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 1717package org .springframework .beans .factory .config ;
1818
1919import org .springframework .beans .factory .NamedBean ;
20+ import org .springframework .util .Assert ;
2021
2122/**
2223 * A simple holder for a given bean name plus bean instance.
@@ -34,20 +35,26 @@ public class NamedBeanHolder<T> implements NamedBean {
3435
3536 /**
3637 * Create a new holder for the given bean name plus instance.
38+ * @param beanName the name of the bean
39+ * @param beanInstance the corresponding bean instance
3740 */
3841 public NamedBeanHolder (String beanName , T beanInstance ) {
42+ Assert .notNull (beanName , "Bean name must not be null" );
3943 this .beanName = beanName ;
4044 this .beanInstance = beanInstance ;
4145 }
4246
4347
48+ /**
49+ * Return the name of the bean (never {@code null}).
50+ */
4451 @ Override
4552 public String getBeanName () {
4653 return this .beanName ;
4754 }
4855
4956 /**
50- * Return the corresponding bean instance.
57+ * Return the corresponding bean instance (can be {@code null}) .
5158 */
5259 public T getBeanInstance () {
5360 return this .beanInstance ;
You can’t perform that action at this time.
0 commit comments