@@ -214,6 +214,7 @@ public interface BeanFactory {
214
214
/**
215
215
* Return a provider for the specified bean, allowing for lazy on-demand retrieval
216
216
* of instances, including availability and uniqueness options.
217
+ * <p>For matching a generic type, consider {@link #getBeanProvider(ResolvableType)}.
217
218
* @param requiredType type the bean must match; can be an interface or superclass
218
219
* @return a corresponding provider handle
219
220
* @since 5.1
@@ -223,13 +224,20 @@ public interface BeanFactory {
223
224
224
225
/**
225
226
* Return a provider for the specified bean, allowing for lazy on-demand retrieval
226
- * of instances, including availability and uniqueness options.
227
- * @param requiredType type the bean must match; can be a generic type declaration.
228
- * Note that collection types are not supported here, in contrast to reflective
227
+ * of instances, including availability and uniqueness options. This variant allows
228
+ * for specifying a generic type to match, similar to reflective injection points
229
+ * with generic type declarations in method/constructor parameters.
230
+ * <p>Note that collections of beans are not supported here, in contrast to reflective
229
231
* injection points. For programmatically retrieving a list of beans matching a
230
232
* specific type, specify the actual bean type as an argument here and subsequently
231
233
* use {@link ObjectProvider#orderedStream()} or its lazy streaming/iteration options.
234
+ * <p>Also, generics matching is strict here, as per the Java assignment rules.
235
+ * For lenient fallback matching with unchecked semantics (similar to the ´unchecked´
236
+ * Java compiler warning), consider calling {@link #getBeanProvider(Class)} with the
237
+ * raw type as a second step if no full generic match is
238
+ * {@link ObjectProvider#getIfAvailable() available} with this variant.
232
239
* @return a corresponding provider handle
240
+ * @param requiredType type the bean must match; can be a generic type declaration
233
241
* @since 5.1
234
242
* @see ObjectProvider#iterator()
235
243
* @see ObjectProvider#stream()
0 commit comments