本文整理匯總了Java中org.springframework.beans.factory.config.ConfigurableListableBeanFactory.containsBeanDefinition方法的典型用法代碼示例。如果您正苦於以下問題:Java ConfigurableListableBeanFactory.containsBeanDefinition方法的具體用法?Java ConfigurableListableBeanFactory.containsBeanDefinition怎麽用?Java ConfigurableListableBeanFactory.containsBeanDefinition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.beans.factory.config.ConfigurableListableBeanFactory
的用法示例。
在下文中一共展示了ConfigurableListableBeanFactory.containsBeanDefinition方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findBeanDefinition
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; //導入方法依賴的package包/類
private BeanDefinition findBeanDefinition(ConfigurableListableBeanFactory beanFactory,
String beanName, boolean considerHierarchy) {
if (beanFactory.containsBeanDefinition(beanName)) {
return beanFactory.getBeanDefinition(beanName);
}
if (considerHierarchy && beanFactory.getParentBeanFactory() instanceof ConfigurableListableBeanFactory) {
return findBeanDefinition(((ConfigurableListableBeanFactory) beanFactory.getParentBeanFactory()), beanName, considerHierarchy);
}
return null;
}
示例2: isLazy
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; //導入方法依賴的package包/類
private boolean isLazy(ConfigurableListableBeanFactory beanFactory, String beanName) {
String name = (beanName.startsWith(BeanFactory.FACTORY_BEAN_PREFIX) ? beanName.substring(1) : beanName);
if (beanFactory.containsBeanDefinition(name)) {
return beanFactory.getBeanDefinition(name).isLazyInit();
}
return false;
}
示例3: shouldSkip
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; //導入方法依賴的package包/類
/**
* Check whether the given bean definition is not subject to the annotation-based
* required property check as performed by this post-processor.
* <p>The default implementations check for the presence of the
* {@link #SKIP_REQUIRED_CHECK_ATTRIBUTE} attribute in the bean definition, if any.
* It also suggests skipping in case of a bean definition with a "factory-bean"
* reference set, assuming that instance-based factories pre-populate the bean.
* @param beanFactory the BeanFactory to check against
* @param beanName the name of the bean to check against
* @return {@code true} to skip the bean; {@code false} to process it
*/
protected boolean shouldSkip(ConfigurableListableBeanFactory beanFactory, String beanName) {
if (beanFactory == null || !beanFactory.containsBeanDefinition(beanName)) {
return false;
}
BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName);
if (beanDefinition.getFactoryBeanName() != null) {
return true;
}
Object value = beanDefinition.getAttribute(SKIP_REQUIRED_CHECK_ATTRIBUTE);
return (value != null && (Boolean.TRUE.equals(value) || Boolean.valueOf(value.toString())));
}
示例4: getResolvedDecoratedDefinition
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; //導入方法依賴的package包/類
protected RootBeanDefinition getResolvedDecoratedDefinition(RootBeanDefinition rbd) {
BeanDefinitionHolder decDef = rbd.getDecoratedDefinition();
if (decDef != null && this.beanFactory instanceof ConfigurableListableBeanFactory) {
ConfigurableListableBeanFactory clbf = (ConfigurableListableBeanFactory) this.beanFactory;
if (clbf.containsBeanDefinition(decDef.getBeanName())) {
BeanDefinition dbd = clbf.getMergedBeanDefinition(decDef.getBeanName());
if (dbd instanceof RootBeanDefinition) {
return (RootBeanDefinition) dbd;
}
}
}
return null;
}
示例5: shouldProxyTargetClass
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; //導入方法依賴的package包/類
/**
* Determine whether the given bean should be proxied with its target
* class rather than its interfaces. Checks the
* {@link #PRESERVE_TARGET_CLASS_ATTRIBUTE "preserveTargetClass" attribute}
* of the corresponding bean definition.
* @param beanFactory the containing ConfigurableListableBeanFactory
* @param beanName the name of the bean
* @return whether the given bean should be proxied with its target class
*/
public static boolean shouldProxyTargetClass(ConfigurableListableBeanFactory beanFactory, String beanName) {
if (beanName != null && beanFactory.containsBeanDefinition(beanName)) {
BeanDefinition bd = beanFactory.getBeanDefinition(beanName);
return Boolean.TRUE.equals(bd.getAttribute(PRESERVE_TARGET_CLASS_ATTRIBUTE));
}
return false;
}