List of usage examples for org.springframework.context.annotation ConditionContext getBeanFactory
@Nullable ConfigurableListableBeanFactory getBeanFactory();
From source file:org.springframework.web.servlet.config.annotation.BeanTypeNotPresentCondition.java
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { ListableBeanFactory factory = context.getBeanFactory(); String[] names = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(factory, this.beanType, false, false); if (ObjectUtils.isEmpty(names)) { logger.debug("No bean of type [" + this.beanType + "]. Conditional configuration applies."); return true; } else {//from www . j a va 2 s . c o m logger.debug("Found bean of type [" + this.beanType + "]. Conditional configuration does not apply."); return false; } }