Package org.springframework.beans.factory.config

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


    protected Object resolveDefaultValue(String value) {
      if (beanFactory == null) {
        return value;
      }
      String placeholdersResolved = beanFactory.resolveEmbeddedValue(value);
      BeanExpressionResolver exprResolver = beanFactory.getBeanExpressionResolver();
      if (exprResolver == null) {
        return value;
      }
      return exprResolver.evaluate(placeholdersResolved, expressionContext);
    }
View Full Code Here


    protected Object resolveDefaultValue(String value) {
      if (beanFactory == null) {
        return value;
      }
      String placeholdersResolved = beanFactory.resolveEmbeddedValue(value);
      BeanExpressionResolver exprResolver = beanFactory.getBeanExpressionResolver();
      if (exprResolver == null) {
        return value;
      }
      return exprResolver.evaluate(placeholdersResolved, expressionContext);
    }
View Full Code Here

    StaticApplicationContext applicationContext = new StaticApplicationContext();
    applicationContext.registerSingleton("support", StandardEvaluationContextPostProcessorSupport.class);
    applicationContext.registerSingleton("postProcessor", PostProcessor.class);
    applicationContext.refresh();
    ConfigurableListableBeanFactory bf = applicationContext.getBeanFactory();
    BeanExpressionResolver resolver = bf.getBeanExpressionResolver();
    resolver.evaluate("#{support}", new BeanExpressionContext(bf, null));
    assertThat(postProcessCalled, is(true));

  }
View Full Code Here

    ApplicationListener<ContextRefreshedEvent> {

  private Collection<? extends StandardEvaluationContextPostProcessor> postProcessors;

  public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    BeanExpressionResolver beanExpressionResolver = beanFactory.getBeanExpressionResolver();
    if (beanExpressionResolver != null) {
      Assert.state(isReplaceable(beanExpressionResolver), "Unable to replace beanExpressionResolver "
          + beanExpressionResolver.getClass());
      beanFactory.setBeanExpressionResolver(new PostProcessorAwareStandardBeanExpressionResolver());
    }
  }
View Full Code Here

    }

    // Explicitly allow environment placeholders inside the expression
    expression = context.getEnvironment().resolvePlaceholders(expression);
    ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
    BeanExpressionResolver resolver = beanFactory.getBeanExpressionResolver();
    BeanExpressionContext expressionContext = (beanFactory != null) ? new BeanExpressionContext(
        beanFactory, null) : null;
    if (resolver == null) {
      resolver = new StandardBeanExpressionResolver();
    }
    boolean result = (Boolean) resolver.evaluate(expression, expressionContext);

    StringBuilder message = new StringBuilder("SpEL expression");
    if (metadata instanceof ClassMetadata) {
      message.append(" on " + ((ClassMetadata) metadata).getClassName());
    }
View Full Code Here

TOP

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

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.