public final class BeanLookup extends Object
ListableBeanFactory
. This is not user
facing API but a mere helper for Spring Data configuration code.Modifier and Type | Method and Description |
---|---|
static <T> Lazy<T> |
lazyIfAvailable(Class<T> type,
BeanFactory beanFactory)
Returns a
Lazy for the unique bean of the given type from the given BeanFactory (which needs to be
a ListableBeanFactory ). |
public static <T> Lazy<T> lazyIfAvailable(Class<T> type, BeanFactory beanFactory)
Lazy
for the unique bean of the given type from the given BeanFactory
(which needs to be
a ListableBeanFactory
). The lookup will produce a NoUniqueBeanDefinitionException
in case multiple
beans of the given type are available in the given BeanFactory
.type
- must not be null.beanFactory
- the BeanFactory
to lookup the bean from.Lazy
for the unique bean of the given type or the instance provided by the fallback in case no
bean of the given type can be found.Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.