@@ -79,57 +79,48 @@ public interface BeanDefinition extends AttributeAccessor, BeanMetadataElement {
79
79
int ROLE_INFRASTRUCTURE = 2 ;
80
80
81
81
82
- /**
83
- * Return the name of the parent definition of this bean definition, if any.
84
- */
85
- String getParentName ();
82
+ // Modifiable attributes
86
83
87
84
/**
88
85
* Set the name of the parent definition of this bean definition, if any.
89
86
*/
90
87
void setParentName (String parentName );
91
88
92
89
/**
93
- * Return the current bean class name of this bean definition.
94
- * <p>Note that this does not have to be the actual class name used at runtime, in
95
- * case of a child definition overriding/inheriting the class name from its parent.
96
- * Hence, do <i>not</i> consider this to be the definitive bean type at runtime but
97
- * rather only use it for parsing purposes at the individual bean definition level.
90
+ * Return the name of the parent definition of this bean definition, if any.
98
91
*/
99
- String getBeanClassName ();
92
+ String getParentName ();
100
93
101
94
/**
102
- * Override the bean class name of this bean definition.
95
+ * Specify the bean class name of this bean definition.
103
96
* <p>The class name can be modified during bean factory post-processing,
104
97
* typically replacing the original class name with a parsed variant of it.
98
+ * @see #setParentName
99
+ * @see #setFactoryBeanName
100
+ * @see #setFactoryMethodName
105
101
*/
106
102
void setBeanClassName (String beanClassName );
107
103
108
104
/**
109
- * Return the factory bean name, if any.
110
- */
111
- String getFactoryBeanName ();
112
-
113
- /**
114
- * Specify the factory bean to use, if any.
115
- */
116
- void setFactoryBeanName (String factoryBeanName );
117
-
118
- /**
119
- * Return a factory method, if any.
105
+ * Return the current bean class name of this bean definition.
106
+ * <p>Note that this does not have to be the actual class name used at runtime, in
107
+ * case of a child definition overriding/inheriting the class name from its parent.
108
+ * Also, this may just be the class that a factory method is called on, or it may
109
+ * even be empty in case of a factory bean reference that a method is called on.
110
+ * Hence, do <i>not</i> consider this to be the definitive bean type at runtime but
111
+ * rather only use it for parsing purposes at the individual bean definition level.
112
+ * @see #getParentName()
113
+ * @see #getFactoryBeanName()
114
+ * @see #getFactoryMethodName()
120
115
*/
121
- String getFactoryMethodName ();
116
+ String getBeanClassName ();
122
117
123
118
/**
124
- * Specify a factory method, if any. This method will be invoked with
125
- * constructor arguments, or with no arguments if none are specified.
126
- * The method will be invoked on the specified factory bean, if any,
127
- * or otherwise as a static method on the local bean class.
128
- * @param factoryMethodName static factory method name,
129
- * or {@code null} if normal constructor creation should be used
130
- * @see #getBeanClassName()
119
+ * Override the target scope of this bean, specifying a new scope name.
120
+ * @see #SCOPE_SINGLETON
121
+ * @see #SCOPE_PROTOTYPE
131
122
*/
132
- void setFactoryMethodName (String factoryMethodName );
123
+ void setScope (String scope );
133
124
134
125
/**
135
126
* Return the name of the current target scope for this bean,
@@ -138,11 +129,11 @@ public interface BeanDefinition extends AttributeAccessor, BeanMetadataElement {
138
129
String getScope ();
139
130
140
131
/**
141
- * Override the target scope of this bean, specifying a new scope name .
142
- * @see #SCOPE_SINGLETON
143
- * @see #SCOPE_PROTOTYPE
132
+ * Set whether this bean should be lazily initialized .
133
+ * <p>If {@code false}, the bean will get instantiated on startup by bean
134
+ * factories that perform eager initialization of singletons.
144
135
*/
145
- void setScope ( String scope );
136
+ void setLazyInit ( boolean lazyInit );
146
137
147
138
/**
148
139
* Return whether this bean should be lazily initialized, i.e. not
@@ -151,47 +142,68 @@ public interface BeanDefinition extends AttributeAccessor, BeanMetadataElement {
151
142
boolean isLazyInit ();
152
143
153
144
/**
154
- * Set whether this bean should be lazily initialized.
155
- * <p>If {@code false}, the bean will get instantiated on startup by bean
156
- * factories that perform eager initialization of singletons.
145
+ * Set the names of the beans that this bean depends on being initialized.
146
+ * The bean factory will guarantee that these beans get initialized first.
157
147
*/
158
- void setLazyInit ( boolean lazyInit );
148
+ void setDependsOn ( String ... dependsOn );
159
149
160
150
/**
161
151
* Return the bean names that this bean depends on.
162
152
*/
163
153
String [] getDependsOn ();
164
154
165
155
/**
166
- * Set the names of the beans that this bean depends on being initialized.
167
- * The bean factory will guarantee that these beans get initialized first.
156
+ * Set whether this bean is a candidate for getting autowired into some other bean.
157
+ * <p>Note that this flag is designed to only affect type-based autowiring.
158
+ * It does not affect explicit references by name, which will get resolved even
159
+ * if the specified bean is not marked as an autowire candidate. As a consequence,
160
+ * autowiring by name will nevertheless inject a bean if the name matches.
168
161
*/
169
- void setDependsOn ( String ... dependsOn );
162
+ void setAutowireCandidate ( boolean autowireCandidate );
170
163
171
164
/**
172
165
* Return whether this bean is a candidate for getting autowired into some other bean.
173
166
*/
174
167
boolean isAutowireCandidate ();
175
168
176
169
/**
177
- * Set whether this bean is a candidate for getting autowired into some other bean.
170
+ * Set whether this bean is a primary autowire candidate.
171
+ * <p>If this value is {@code true} for exactly one bean among multiple
172
+ * matching candidates, it will serve as a tie-breaker.
178
173
*/
179
- void setAutowireCandidate (boolean autowireCandidate );
174
+ void setPrimary (boolean primary );
180
175
181
176
/**
182
177
* Return whether this bean is a primary autowire candidate.
183
- * If this value is true for exactly one bean among multiple
184
- * matching candidates, it will serve as a tie-breaker.
185
178
*/
186
179
boolean isPrimary ();
187
180
188
181
/**
189
- * Set whether this bean is a primary autowire candidate .
190
- * <p>If this value is true for exactly one bean among multiple
191
- * matching candidates, it will serve as a tie-breaker.
182
+ * Specify the factory bean to use, if any .
183
+ * This the name of the bean to call the specified factory method on.
184
+ * @see #setFactoryMethodName
192
185
*/
193
- void setPrimary (boolean primary );
186
+ void setFactoryBeanName (String factoryBeanName );
187
+
188
+ /**
189
+ * Return the factory bean name, if any.
190
+ */
191
+ String getFactoryBeanName ();
192
+
193
+ /**
194
+ * Specify a factory method, if any. This method will be invoked with
195
+ * constructor arguments, or with no arguments if none are specified.
196
+ * The method will be invoked on the specified factory bean, if any,
197
+ * or otherwise as a static method on the local bean class.
198
+ * @see #setFactoryBeanName
199
+ * @see #setBeanClassName
200
+ */
201
+ void setFactoryMethodName (String factoryMethodName );
194
202
203
+ /**
204
+ * Return a factory method, if any.
205
+ */
206
+ String getFactoryMethodName ();
195
207
196
208
/**
197
209
* Return the constructor argument values for this bean.
@@ -208,6 +220,8 @@ public interface BeanDefinition extends AttributeAccessor, BeanMetadataElement {
208
220
MutablePropertyValues getPropertyValues ();
209
221
210
222
223
+ // Read-only attributes
224
+
211
225
/**
212
226
* Return whether this a <b>Singleton</b>, with a single, shared instance
213
227
* returned on all calls.
0 commit comments