public class HierarchicalBeanLoader extends Object implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.FactoryBean, org.springframework.context.ApplicationContextAware
DEFAULT_DIALECT_PLACEHOLDER
is replaced with successive class
names starting from the dialect class
and
progressing up the hierarchy until the base class
is reached. The bean is looked up in the context at each point until the
bean is found or the base of the class hierarchy is reached.
For example assume bean names:BEAN 1: contentDAO.org.hibernate.dialect.Dialect BEAN 2: contentDAO.org.hibernate.dialect.MySQLInnoDBDialect BEAN 3: propertyValueDAO.org.hibernate.dialect.Dialect BEAN 4: propertyValueDAO.org.hibernate.dialect.MySQLDialectand
dialectBaseClass = org.hibernate.dialect.DialectFor dialect org.hibernate.dialect.MySQLInnoDBDialect the following will be returned:
contentDAO.bean.dialect == BEAN 2 propertyValueDAO.bean.dialect == BEAN 4For dialectorg.hibernate.dialect.MySQLDBDialect the following will be returned:
contentDAO.bean.dialect == BEAN 1 propertyValueDAO.bean.dialect == BEAN 4For dialectorg.hibernate.dialect.Dialect the following will be returned:
contentDAO.bean.dialect == BEAN 1 propertyValueDAO.bean.dialect == BEAN 3
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DIALECT_PLACEHOLDER |
static String |
DEFAULT_DIALECT_REGEX |
Constructor and Description |
---|
HierarchicalBeanLoader()
Create a new HierarchicalResourceLoader.
|
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
Object |
getObject()
Replaces the
|
Class<?> |
getObjectType() |
boolean |
isSingleton() |
void |
setApplicationContext(org.springframework.context.ApplicationContext ctx)
The application context that this bean factory serves.
|
void |
setDialectBaseClass(String className)
Set the class to be used during hierarchical dialect replacement.
|
void |
setDialectClass(String className) |
void |
setTargetBeanName(String targetBeanName) |
void |
setTargetClass(Class<?> targetClass)
Set the target class that will be returned by
getObjectType() |
public static final String DEFAULT_DIALECT_PLACEHOLDER
public static final String DEFAULT_DIALECT_REGEX
public HierarchicalBeanLoader()
public void setApplicationContext(org.springframework.context.ApplicationContext ctx)
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
public void setTargetBeanName(String targetBeanName)
targetBeanName
- the name of the target bean to return,
including the DEFAULT_DIALECT_PLACEHOLDER
where the specific dialect must be replaced.public void setTargetClass(Class<?> targetClass)
getObjectType()
targetClass
- the type that this factory returnspublic void setDialectBaseClass(String className)
className
- the name of the class or interfacepublic void setDialectClass(String className)
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public Class<?> getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean
target class
public boolean isSingleton()
isSingleton
in interface org.springframework.beans.factory.FactoryBean
Copyright © 2005–2019 Alfresco Software. All rights reserved.