public class BaseLdapPathBeanPostProcessor extends Object implements BeanPostProcessor, ApplicationContextAware, Ordered
BeanPostProcessor
checks each bean if it implements
BaseLdapNameAware
or BaseLdapPathAware
.
If it does, the default context base LDAP path will be determined,
and that value will be injected to the BaseLdapNameAware.setBaseLdapPath(javax.naming.ldap.LdapName)
or BaseLdapPathAware.setBaseLdapPath(DistinguishedName)
method of the
processed bean.
If the baseLdapPath
property of this
BeanPostProcessor
is set, that value will be used. Otherwise, in
order to determine which base LDAP path to supply to the instance the
ApplicationContext
is searched for any beans that are
implementations of BaseLdapPathSource
. If one single occurrence is
found, that instance is queried for its base path, and that is what will be
injected. If more than one BaseLdapPathSource
instance is configured
in the ApplicationContext
, the name of the one to use will need
to be specified to the baseLdapPathSourceName
property;
otherwise the post processing will fail. If no BaseLdapPathSource
implementing bean is found in the context and the basePath
property is not set, post processing will also fail.
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
BaseLdapPathBeanPostProcessor() |
Modifier and Type | Method and Description |
---|---|
int |
getOrder() |
Object |
postProcessAfterInitialization(Object bean,
String beanName) |
Object |
postProcessBeforeInitialization(Object bean,
String beanName) |
void |
setApplicationContext(ApplicationContext applicationContext) |
void |
setBaseLdapPathSourceName(String contextSourceName)
Set the name of the
ContextSource bean to use for getting
the base path. |
void |
setBasePath(DistinguishedName basePath)
Deprecated.
DistinguishedName and associated classes and methods are deprecated as of 2.0. |
void |
setBasePath(String basePath) |
void |
setOrder(int order)
Set the order value of this object for sorting purposes.
|
public Object postProcessBeforeInitialization(Object bean, String beanName)
postProcessBeforeInitialization
in interface BeanPostProcessor
public Object postProcessAfterInitialization(Object bean, String beanName)
postProcessAfterInitialization
in interface BeanPostProcessor
public void setApplicationContext(ApplicationContext applicationContext)
setApplicationContext
in interface ApplicationContextAware
public void setBasePath(DistinguishedName basePath)
DistinguishedName
and associated classes and methods are deprecated as of 2.0.BaseLdapPathAware
beans.
If this property is not set, the default base path will be determined
from any defined BaseLdapPathSource
instances available in the
ApplicationContext
.basePath
- the base path.public void setBasePath(String basePath)
public void setBaseLdapPathSourceName(String contextSourceName)
ContextSource
bean to use for getting
the base path. This method is typically useful if several ContextSource
instances have been configured.contextSourceName
- the name of the ContextSource
bean
to use for determining the base path.public void setOrder(int order)
order
- the order of this instance. Defaults to Ordered.LOWEST_PRECEDENCE
.Ordered