Package org.springframework.beans.factory

Examples of org.springframework.beans.factory.BeanFactory.containsBean()


  @Override
  public Object getValue(ELContext elContext, Object base, Object property) throws ELException {
    if (base == null) {
      String beanName = property.toString();
      BeanFactory bf = getBeanFactory(elContext);
      if (bf.containsBean(beanName)) {
        if (logger.isTraceEnabled()) {
          logger.trace("Successfully resolved variable '" + beanName + "' in Spring BeanFactory");
        }
        elContext.setPropertyResolved(true);
        return bf.getBean(beanName);
View Full Code Here


  @Override
  public Class<?> getType(ELContext elContext, Object base, Object property) throws ELException {
    if (base == null) {
      String beanName = property.toString();
      BeanFactory bf = getBeanFactory(elContext);
      if (bf.containsBean(beanName)) {
        elContext.setPropertyResolved(true);
        return bf.getType(beanName);
      }
    }
    return null;
View Full Code Here

  @Override
  public void setValue(ELContext elContext, Object base, Object property, Object value) throws ELException {
    if (base == null) {
      String beanName = property.toString();
      BeanFactory bf = getBeanFactory(elContext);
      if (bf.containsBean(beanName)) {
        throw new PropertyNotWritableException(
            "Variable '" + beanName + "' refers to a Spring bean which by definition is not writable");
      }
    }
  }
View Full Code Here

  @Override
  public boolean isReadOnly(ELContext elContext, Object base, Object property) throws ELException {
    if (base == null) {
      String beanName = property.toString();
      BeanFactory bf = getBeanFactory(elContext);
      if (bf.containsBean(beanName)) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

    if (containsSingleton(beanName) || containsBeanDefinition(beanName)) {
      return (!BeanFactoryUtils.isFactoryDereference(name) || isFactoryBean(name));
    }
    // Not found -> check parent.
    BeanFactory parentBeanFactory = getParentBeanFactory();
    return (parentBeanFactory != null && parentBeanFactory.containsBean(originalBeanName(name)));
  }

  public boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
    String beanName = transformedBeanName(name);
View Full Code Here

    // Ask Spring root application context.
    if (logger.isDebugEnabled()) {
      logger.debug("Attempting to resolve variable '" + name + "' in root WebApplicationContext");
    }
    BeanFactory bf = getBeanFactory(facesContext);
    if (bf.containsBean(name)) {
      if (logger.isDebugEnabled()) {
        logger.debug("Successfully resolved variable '" + name + "' in root WebApplicationContext");
      }
      return bf.getBean(name);
    }
View Full Code Here

      ReflectionUtils.invokeMethod(validateMethod, model, new Object[] { requestContext.getMessageContext() });
    }
    BeanFactory beanFactory = requestContext.getActiveFlow().getApplicationContext();
    if (beanFactory != null) {
      String validatorName = getModelExpression().getExpressionString() + "Validator";
      if (beanFactory.containsBean(validatorName)) {
        Object validator = beanFactory.getBean(validatorName);
        validateMethod = ReflectionUtils.findMethod(validator.getClass(), validateMethodName, new Class[] {
            model.getClass(), MessageContext.class });
        if (validateMethod != null) {
          ReflectionUtils.invokeMethod(validateMethod, validator, new Object[] { model,
View Full Code Here

    // Set up initial context
    sncb.bind(BEAN_FACTORY_PATH_ENVIRONMENT_KEY, path);

    ContextJndiBeanFactoryLocator jbfl = new ContextJndiBeanFactoryLocator();
    BeanFactory bf = jbfl.useBeanFactory(BEAN_FACTORY_PATH_ENVIRONMENT_KEY).getFactory();
    assertTrue(bf.containsBean("rod"));
    assertTrue(bf instanceof ApplicationContext);
  }

  public void testBeanFactoryPathFromJndiEnvironmentWithMultipleFiles() throws Exception {
    SimpleNamingContextBuilder sncb = SimpleNamingContextBuilder.emptyActivatedContextBuilder();
View Full Code Here

    // Set up initial context
    sncb.bind(BEAN_FACTORY_PATH_ENVIRONMENT_KEY, path);

    ContextJndiBeanFactoryLocator jbfl = new ContextJndiBeanFactoryLocator();
    BeanFactory bf = jbfl.useBeanFactory(BEAN_FACTORY_PATH_ENVIRONMENT_KEY).getFactory();
    assertTrue(bf.containsBean("rod"));
    assertTrue(bf.containsBean("inheritedTestBean"));
  }

}
View Full Code Here

    sncb.bind(BEAN_FACTORY_PATH_ENVIRONMENT_KEY, path);

    ContextJndiBeanFactoryLocator jbfl = new ContextJndiBeanFactoryLocator();
    BeanFactory bf = jbfl.useBeanFactory(BEAN_FACTORY_PATH_ENVIRONMENT_KEY).getFactory();
    assertTrue(bf.containsBean("rod"));
    assertTrue(bf.containsBean("inheritedTestBean"));
  }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.