@Target(value=TYPE) @Retention(value=RUNTIME) @Documented @Import(value=com.holonplatform.spring.internal.context.BeanFactoryScopeRegistrar.class) public @interface EnableBeanContext
Context
scope using Spring application context (or in exact terms, using the application context
BeanFactory
) to provide context resource instances as Spring beans.
When a context resource is requested (using Context.resource(String, Class)
), the scope strategy to provide a
matching Spring bean is defined as follow:
lookupByType()
is true
and a Spring bean of the required type, ignoring the
name, is present and only one candidate is available, this instance is returned.
The Spring BeanFactory behaviour is preserved during beans lookup, so, for example, Spring beans scopes strategy is
applied, just like bean retrieval using BeanFactory.getBean(String, Class)
and similar methods.
Modifier and Type | Fields and Description |
---|---|
static String |
LOOKUP_BY_TYPE_PROPERTY_NAME
Property which can be used to configure the
lookupByType() behaviour using a Spring Environment
configuration property. |
Modifier and Type | Optional Element and Description |
---|---|
boolean |
lookupByType
Whether to lookup context resource bean candidates by type, ignoring bean name, when default lookup by name and
type fails.
|
public static final String LOOKUP_BY_TYPE_PROPERTY_NAME
lookupByType()
behaviour using a Spring Environment
configuration property. If setted, overrides the lookupByType()
annotation attribute value.public abstract boolean lookupByType
true
to lookup context resource bean candidates by type ignoring bean name and context
resource key matchCopyright © 2018 The Holon Platform. All rights reserved.