Interface BeanRegistry.SupplierContext
- Enclosing interface:
- BeanRegistry
public static interface BeanRegistry.SupplierContext
Context available from the bean instance supplier designed to give access
to bean dependencies.
- Since:
- 7.0
- Author:
- Sebastien Deleuze
- 
Method SummaryModifier and TypeMethodDescription<T> TReturn the bean instance that uniquely matches the given type, if any.<T> TReturn an instance, which may be shared or independent, of the specified bean.<T> Tbean(ParameterizedTypeReference<T> beanType) Return the bean instance that uniquely matches the given generics-containing type, if any.<T> ObjectProvider<T> beanProvider(Class<T> beanClass) Return a provider for the specified bean, allowing for lazy on-demand retrieval of instances, including availability and uniqueness options.<T> ObjectProvider<T> beanProvider(ParameterizedTypeReference<T> beanType) Return a provider for the specified bean, allowing for lazy on-demand retrieval of instances, including availability and uniqueness options.
- 
Method Details- 
beanReturn the bean instance that uniquely matches the given type, if any.- Parameters:
- beanClass- the type the bean must match; can be an interface or superclass
- Returns:
- an instance of the single bean matching the bean type
- Throws:
- BeansException
- See Also:
 
- 
beanReturn the bean instance that uniquely matches the given generics-containing type, if any.- Parameters:
- beanType- the generics-containing type the bean must match; can be an interface or superclass
- Returns:
- an instance of the single bean matching the bean type
- Throws:
- BeansException
- See Also:
 
- 
beanReturn an instance, which may be shared or independent, of the specified bean.- Parameters:
- name- the name of the bean to retrieve
- beanClass- the type the bean must match; can be an interface or superclass
- Returns:
- an instance of the bean.
- Throws:
- BeansException
- See Also:
 
- 
beanProviderReturn a provider for the specified bean, allowing for lazy on-demand retrieval of instances, including availability and uniqueness options.For matching a generic type, consider beanProvider(ParameterizedTypeReference).- Parameters:
- beanClass- the type the bean must match; can be an interface or superclass
- Returns:
- a corresponding provider handle
- See Also:
 
- 
beanProviderReturn a provider for the specified bean, allowing for lazy on-demand retrieval of instances, including availability and uniqueness options. This variant allows for specifying a generic type to match, similar to reflective injection points with generic type declarations in method/constructor parameters.Note that collections of beans are not supported here, in contrast to reflective injection points. For programmatically retrieving a list of beans matching a specific type, specify the actual bean type as an argument here and subsequently use ObjectProvider.orderedStream()or its lazy streaming/iteration options.Also, generics matching is strict here, as per the Java assignment rules. For lenient fallback matching with unchecked semantics (similar to the 'unchecked' Java compiler warning), consider calling beanProvider(Class)with the raw type as a second step if no full generic match isavailablewith this variant.- Parameters:
- beanType- the generics-containing type the bean must match; can be an interface or superclass
- Returns:
- a corresponding provider handle
- See Also:
 
 
-