public interface BeanConfigurationContext
| Modifier and Type | Method and Description |
|---|---|
<T> void |
assignRole(Class<T> role,
BeanReference<? extends T> reference)
Assign a role to a bean reference.
|
<T> void |
define(Class<T> exposedType,
BeanFactory<T> factory)
Define a way to resolve a bean referenced by its
exposedType. |
<T> void |
define(Class<T> exposedType,
String name,
BeanFactory<T> factory)
Define a way to resolve a bean referenced by its
exposedType and name. |
<T> void define(Class<T> exposedType, BeanFactory<T> factory)
exposedType.
Affects the behavior of BeanResolver.resolve(Class)
in particular.
T - The exposed type of the bean.exposedType - The type that this definition will match (exact match: inheritance is ignored).factory - The factory allowing to create the bean.<T> void define(Class<T> exposedType, String name, BeanFactory<T> factory)
exposedType and name.
Affects the behavior of BeanResolver.resolve(Class, String)
in particular.
T - The exposed type of the bean.exposedType - The type that this definition will match (exact match: inheritance is ignored).name - The name that this definition will match (exact match: case is taken into account).factory - The factory allowing to create the bean.<T> void assignRole(Class<T> role, BeanReference<? extends T> reference)
Affects the behavior of BeanResolver.resolveRole(Class)
in particular.
Roles allow to overcome limitations of the Spring/CDI integrations, which can only ever return one bean for a given reference (obviously that's a limitation of our SPI, not of Spring/CDI). With roles, you can define multiple beans in Spring/CDI, and assign the same role to all of them. to separate the bean definition from the selection of the beans to use in Hibernate Search: you can define a hundred beans implementing a given interface, but only assign a role to one of them, based on configuration.
T - The role type.role - A type representing the role that this reference will match (exact match: inheritance is ignored).reference - A reference to a bean to use when the given role is requested.Copyright © 2006-2019 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.