public class BeanDefinitionReaderUtils
extends java.lang.Object
PropertiesBeanDefinitionReader
,
DefaultBeanDefinitionDocumentReader
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
GENERATED_BEAN_NAME_SEPARATOR
Separator for generated bean names.
|
Constructor and Description |
---|
BeanDefinitionReaderUtils() |
Modifier and Type | Method and Description |
---|---|
static AbstractBeanDefinition |
createBeanDefinition(java.lang.String parentName,
java.lang.String className,
java.lang.ClassLoader classLoader)
Create a new GenericBeanDefinition for the given parent name and class name,
eagerly loading the bean class if a ClassLoader has been specified.
|
static java.lang.String |
generateBeanName(BeanDefinition beanDefinition,
BeanDefinitionRegistry registry)
Generate a bean name for the given top-level bean definition,
unique within the given bean factory.
|
static java.lang.String |
generateBeanName(BeanDefinition definition,
BeanDefinitionRegistry registry,
boolean isInnerBean)
Generate a bean name for the given bean definition, unique within the
given bean factory.
|
static void |
registerBeanDefinition(BeanDefinitionHolder definitionHolder,
BeanDefinitionRegistry registry)
Register the given bean definition with the given bean factory.
|
static java.lang.String |
registerWithGeneratedName(AbstractBeanDefinition definition,
BeanDefinitionRegistry registry)
Register the given bean definition with a generated name,
unique within the given bean factory.
|
public static final java.lang.String GENERATED_BEAN_NAME_SEPARATOR
public static AbstractBeanDefinition createBeanDefinition(java.lang.String parentName, java.lang.String className, java.lang.ClassLoader classLoader) throws java.lang.ClassNotFoundException
parentName
- the name of the parent bean, if anyclassName
- the name of the bean class, if anyclassLoader
- the ClassLoader to use for loading bean classes
(can be null
to just register bean classes by name)java.lang.ClassNotFoundException
- if the bean class could not be loadedpublic static java.lang.String generateBeanName(BeanDefinition beanDefinition, BeanDefinitionRegistry registry) throws BeanDefinitionStoreException
beanDefinition
- the bean definition to generate a bean name forregistry
- the bean factory that the definition is going to be
registered with (to check for existing bean names)BeanDefinitionStoreException
- if no unique name can be generated
for the given bean definitiongenerateBeanName(BeanDefinition, BeanDefinitionRegistry, boolean)
public static java.lang.String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry, boolean isInnerBean) throws BeanDefinitionStoreException
definition
- the bean definition to generate a bean name forregistry
- the bean factory that the definition is going to be
registered with (to check for existing bean names)isInnerBean
- whether the given bean definition will be registered
as inner bean or as top-level bean (allowing for special name generation
for inner beans versus top-level beans)BeanDefinitionStoreException
- if no unique name can be generated
for the given bean definitionpublic static void registerBeanDefinition(BeanDefinitionHolder definitionHolder, BeanDefinitionRegistry registry) throws BeanDefinitionStoreException
definitionHolder
- the bean definition including name and aliasesregistry
- the bean factory to register withBeanDefinitionStoreException
- if registration failedpublic static java.lang.String registerWithGeneratedName(AbstractBeanDefinition definition, BeanDefinitionRegistry registry) throws BeanDefinitionStoreException
definition
- the bean definition to generate a bean name forregistry
- the bean factory to register withBeanDefinitionStoreException
- if no unique name can be generated
for the given bean definition or the definition cannot be registered