Package org.springframework.beans.factory.config

Examples of org.springframework.beans.factory.config.BeanExpressionContext


         // we cannot continue without a ConfigurableBeanFactory
         if (beanFactory == null) {
            throw new IllegalStateException("Unable to find a ConfigurableBeanFactory");
         }

         BeanExpressionContext beanEvaluationContext = new BeanExpressionContext(beanFactory, null);

         StandardEvaluationContext sec = new StandardEvaluationContext();
         sec.setRootObject(beanEvaluationContext);
         sec.addPropertyAccessor(new BeanExpressionContextAccessor());
         sec.addPropertyAccessor(new BeanFactoryAccessor());
         sec.addPropertyAccessor(new MapAccessor());
         sec.setBeanResolver(new BeanFactoryResolver(beanEvaluationContext.getBeanFactory()));
         sec.setTypeLocator(new StandardTypeLocator(beanEvaluationContext.getBeanFactory().getBeanClassLoader()));
         ConversionService conversionService = beanEvaluationContext.getBeanFactory().getConversionService();
         if (conversionService != null) {
            sec.setTypeConverter(new StandardTypeConverter(conversionService));
         }

         _evaluationContext = sec;
View Full Code Here


   * and #{...} SpEL expressions in default values, or {@code null} if default
   * values are not expected to contain expressions
   */
  public AbstractNamedValueMethodArgumentResolver(ConfigurableBeanFactory beanFactory) {
    this.configurableBeanFactory = beanFactory;
    this.expressionContext = (beanFactory != null) ? new BeanExpressionContext(beanFactory, new RequestScope()) : null;
  }
View Full Code Here

  protected Object evaluateBeanDefinitionString(String value, BeanDefinition beanDefinition) {
    if (this.beanExpressionResolver == null) {
      return value;
    }
    Scope scope = (beanDefinition != null ? getRegisteredScope(beanDefinition.getScope()) : null);
    return this.beanExpressionResolver.evaluate(value, new BeanExpressionContext(this, scope));
  }
View Full Code Here

  protected Object evaluateBeanDefinitionString(String value, BeanDefinition beanDefinition) {
    if (this.beanExpressionResolver == null) {
      return value;
    }
    Scope scope = getRegisteredScope(beanDefinition.getScope());
    return this.beanExpressionResolver.evaluate(value, new BeanExpressionContext(this, scope));
  }
View Full Code Here

  protected Object evaluateBeanDefinitionString(String value, BeanDefinition beanDefinition) {
    if (this.beanExpressionResolver == null) {
      return value;
    }
    Scope scope = (beanDefinition != null ? getRegisteredScope(beanDefinition.getScope()) : null);
    return this.beanExpressionResolver.evaluate(value, new BeanExpressionContext(this, scope));
  }
View Full Code Here

   * @param beanFactory a bean factory to use for resolving  ${...} placeholder and #{...} SpEL expressions
   * in default values, or {@code null} if default values are not expected to contain expressions
   */
  public AbstractNamedValueMethodArgumentResolver(ConfigurableBeanFactory beanFactory) {
    this.configurableBeanFactory = beanFactory;
    this.expressionContext = (beanFactory != null) ? new BeanExpressionContext(beanFactory, new RequestScope()) : null;
  }
View Full Code Here

  }

  public void setBeanFactory(BeanFactory beanFactory) {
    if (beanFactory instanceof ConfigurableBeanFactory) {
      this.beanFactory = (ConfigurableBeanFactory) beanFactory;
      this.expressionContext = new BeanExpressionContext(this.beanFactory, new RequestScope());
    }
  }
View Full Code Here

  }

  public void setBeanFactory(BeanFactory beanFactory) {
    if (beanFactory instanceof ConfigurableBeanFactory) {
      this.beanFactory = (ConfigurableBeanFactory) beanFactory;
      this.expressionContext = new BeanExpressionContext(this.beanFactory, new RequestScope());
    }
  }
View Full Code Here

  }

  public void setBeanFactory(BeanFactory beanFactory) {
    if (beanFactory instanceof ConfigurableBeanFactory) {
      this.beanFactory = (ConfigurableBeanFactory) beanFactory;
      this.expressionContext = new BeanExpressionContext(this.beanFactory, new RequestScope());
    }
  }
View Full Code Here

      }
      else if(getBeanFactory() instanceof AbstractBeanFactory) {
         AbstractBeanFactory bf = (AbstractBeanFactory)getBeanFactory();
        
         return bf.getBeanExpressionResolver().evaluate(expressionStr,
               new BeanExpressionContext(bf, null));
      }
      return null;
   }
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.config.BeanExpressionContext

Copyright © 2018 www.massapicom. 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.