本文整理匯總了Java中org.springframework.beans.factory.BeanNameAware類的典型用法代碼示例。如果您正苦於以下問題:Java BeanNameAware類的具體用法?Java BeanNameAware怎麽用?Java BeanNameAware使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BeanNameAware類屬於org.springframework.beans.factory包,在下文中一共展示了BeanNameAware類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: AbstractAutowireCapableBeanFactory
import org.springframework.beans.factory.BeanNameAware; //導入依賴的package包/類
/**
* Create a new AbstractAutowireCapableBeanFactory.
*/
public AbstractAutowireCapableBeanFactory() {
super();
ignoreDependencyInterface(BeanNameAware.class);
ignoreDependencyInterface(BeanFactoryAware.class);
ignoreDependencyInterface(BeanClassLoaderAware.class);
}
示例2: invokeAwareMethods
import org.springframework.beans.factory.BeanNameAware; //導入依賴的package包/類
private void invokeAwareMethods(final String beanName, final Object bean) {
if (bean instanceof Aware) {
if (bean instanceof BeanNameAware) {
((BeanNameAware) bean).setBeanName(beanName);
}
if (bean instanceof BeanClassLoaderAware) {
((BeanClassLoaderAware) bean).setBeanClassLoader(getBeanClassLoader());
}
if (bean instanceof BeanFactoryAware) {
((BeanFactoryAware) bean).setBeanFactory(AbstractAutowireCapableBeanFactory.this);
}
}
}
示例3: testTargetIsBeanNameAware
import org.springframework.beans.factory.BeanNameAware; //導入依賴的package包/類
@Test
public void testTargetIsBeanNameAware() {
assertTrue("target bean is bean name aware",this.target instanceof BeanNameAware);
}
示例4: postProcessBeforeDestruction
import org.springframework.beans.factory.BeanNameAware; //導入依賴的package包/類
@Override
public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException {
if (bean instanceof BeanNameAware) {
((BeanNameAware) bean).setBeanName(null);
}
}