org.springframework.context.expression.BeanFactoryResolver.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(81)

本文整理了Java中org.springframework.context.expression.BeanFactoryResolver.<init>()方法的一些代码示例,展示了BeanFactoryResolver.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BeanFactoryResolver.<init>()方法的具体详情如下:
包路径:org.springframework.context.expression.BeanFactoryResolver
类名称:BeanFactoryResolver
方法名:<init>

BeanFactoryResolver.<init>介绍

[英]Create a new BeanFactoryResolver for the given factory.
[中]

代码示例

代码示例来源:origin: spring-projects/spring-security

public void setApplicationContext(ApplicationContext applicationContext) {
    br = new BeanFactoryResolver(applicationContext);
  }
}

代码示例来源:origin: org.springframework.security/spring-security-core

public void setApplicationContext(ApplicationContext applicationContext) {
    br = new BeanFactoryResolver(applicationContext);
  }
}

代码示例来源:origin: spring-projects/spring-security

@Override
  public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    this.beanResolver = new BeanFactoryResolver(applicationContext.getAutowireCapableBeanFactory());
  }
}

代码示例来源:origin: spring-projects/spring-retry

@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
  this.beanFactory = beanFactory;
  this.evaluationContext.setBeanResolver(new BeanFactoryResolver(beanFactory));
}

代码示例来源:origin: spring-projects/spring-retry

@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
  this.evaluationContext.setBeanResolver(new BeanFactoryResolver(beanFactory));
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Specify if the condition defined by the specified expression matches.
 */
public boolean condition(String conditionExpression, ApplicationEvent event, Method targetMethod,
    AnnotatedElementKey methodKey, Object[] args, @Nullable BeanFactory beanFactory) {
  EventExpressionRootObject root = new EventExpressionRootObject(event, args);
  MethodBasedEvaluationContext evaluationContext = new MethodBasedEvaluationContext(
      root, targetMethod, args, getParameterNameDiscoverer());
  if (beanFactory != null) {
    evaluationContext.setBeanResolver(new BeanFactoryResolver(beanFactory));
  }
  return (Boolean.TRUE.equals(getExpression(this.conditionCache, methodKey, conditionExpression).getValue(
      evaluationContext, Boolean.class)));
}

代码示例来源:origin: spring-projects/spring-security

@Bean
public AuthenticationPrincipalArgumentResolver authenticationPrincipalArgumentResolver() {
  AuthenticationPrincipalArgumentResolver resolver = new AuthenticationPrincipalArgumentResolver(
    this.adapterRegistry);
  if (this.beanFactory != null) {
    resolver.setBeanResolver(new BeanFactoryResolver(this.beanFactory));
  }
  return resolver;
}

代码示例来源:origin: org.springframework/spring-context

/**
 * Specify if the condition defined by the specified expression matches.
 */
public boolean condition(String conditionExpression, ApplicationEvent event, Method targetMethod,
    AnnotatedElementKey methodKey, Object[] args, @Nullable BeanFactory beanFactory) {
  EventExpressionRootObject root = new EventExpressionRootObject(event, args);
  MethodBasedEvaluationContext evaluationContext = new MethodBasedEvaluationContext(
      root, targetMethod, args, getParameterNameDiscoverer());
  if (beanFactory != null) {
    evaluationContext.setBeanResolver(new BeanFactoryResolver(beanFactory));
  }
  return (Boolean.TRUE.equals(getExpression(this.conditionCache, methodKey, conditionExpression).getValue(
      evaluationContext, Boolean.class)));
}

代码示例来源:origin: spring-cloud/spring-cloud-gateway

static Object getValue(SpelExpressionParser parser, BeanFactory beanFactory, String entryValue) {
  Object value;
  String rawValue = entryValue;
  if (rawValue != null) {
    rawValue = rawValue.trim();
  }
  if (rawValue != null && rawValue.startsWith("#{") && entryValue.endsWith("}")) {
    // assume it's spel
    StandardEvaluationContext context = new StandardEvaluationContext();
    context.setBeanResolver(new BeanFactoryResolver(beanFactory));
    Expression expression = parser.parseExpression(entryValue, new TemplateParserContext());
    value = expression.getValue(context);
  } else {
    value = entryValue;
  }
  return value;
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Create an {@link EvaluationContext}.
 * @param caches the current caches
 * @param method the method
 * @param args the method arguments
 * @param target the target object
 * @param targetClass the target class
 * @param result the return value (can be {@code null}) or
 * {@link #NO_RESULT} if there is no return at this time
 * @return the evaluation context
 */
public EvaluationContext createEvaluationContext(Collection<? extends Cache> caches,
    Method method, Object[] args, Object target, Class<?> targetClass, Method targetMethod,
    @Nullable Object result, @Nullable BeanFactory beanFactory) {
  CacheExpressionRootObject rootObject = new CacheExpressionRootObject(
      caches, method, args, target, targetClass);
  CacheEvaluationContext evaluationContext = new CacheEvaluationContext(
      rootObject, targetMethod, args, getParameterNameDiscoverer());
  if (result == RESULT_UNAVAILABLE) {
    evaluationContext.addUnavailableVariable(RESULT_VARIABLE);
  }
  else if (result != NO_RESULT) {
    evaluationContext.setVariable(RESULT_VARIABLE, result);
  }
  if (beanFactory != null) {
    evaluationContext.setBeanResolver(new BeanFactoryResolver(beanFactory));
  }
  return evaluationContext;
}

代码示例来源:origin: spring-projects/spring-framework

sec.addPropertyAccessor(new MapAccessor());
sec.addPropertyAccessor(new EnvironmentAccessor());
sec.setBeanResolver(new BeanFactoryResolver(evalContext.getBeanFactory()));
sec.setTypeLocator(new StandardTypeLocator(evalContext.getBeanFactory().getBeanClassLoader()));
ConversionService conversionService = evalContext.getBeanFactory().getConversionService();

代码示例来源:origin: org.springframework/spring-context

/**
 * Create an {@link EvaluationContext}.
 * @param caches the current caches
 * @param method the method
 * @param args the method arguments
 * @param target the target object
 * @param targetClass the target class
 * @param result the return value (can be {@code null}) or
 * {@link #NO_RESULT} if there is no return at this time
 * @return the evaluation context
 */
public EvaluationContext createEvaluationContext(Collection<? extends Cache> caches,
    Method method, Object[] args, Object target, Class<?> targetClass, Method targetMethod,
    @Nullable Object result, @Nullable BeanFactory beanFactory) {
  CacheExpressionRootObject rootObject = new CacheExpressionRootObject(
      caches, method, args, target, targetClass);
  CacheEvaluationContext evaluationContext = new CacheEvaluationContext(
      rootObject, targetMethod, args, getParameterNameDiscoverer());
  if (result == RESULT_UNAVAILABLE) {
    evaluationContext.addUnavailableVariable(RESULT_VARIABLE);
  }
  else if (result != NO_RESULT) {
    evaluationContext.setVariable(RESULT_VARIABLE, result);
  }
  if (beanFactory != null) {
    evaluationContext.setBeanResolver(new BeanFactoryResolver(beanFactory));
  }
  return evaluationContext;
}

代码示例来源:origin: org.springframework/spring-context

sec.addPropertyAccessor(new MapAccessor());
sec.addPropertyAccessor(new EnvironmentAccessor());
sec.setBeanResolver(new BeanFactoryResolver(evalContext.getBeanFactory()));
sec.setTypeLocator(new StandardTypeLocator(evalContext.getBeanFactory().getBeanClassLoader()));
ConversionService conversionService = evalContext.getBeanFactory().getConversionService();

代码示例来源:origin: spring-projects/spring-framework

private EvaluationContext createEvaluationContext(PageContext pageContext) {
  StandardEvaluationContext context = new StandardEvaluationContext();
  context.addPropertyAccessor(new JspPropertyAccessor(pageContext));
  context.addPropertyAccessor(new MapAccessor());
  context.addPropertyAccessor(new EnvironmentAccessor());
  context.setBeanResolver(new BeanFactoryResolver(getRequestContext().getWebApplicationContext()));
  ConversionService conversionService = getConversionService(pageContext);
  if (conversionService != null) {
    context.setTypeConverter(new StandardTypeConverter(conversionService));
  }
  return context;
}

代码示例来源:origin: org.springframework/spring-webmvc

private EvaluationContext createEvaluationContext(PageContext pageContext) {
  StandardEvaluationContext context = new StandardEvaluationContext();
  context.addPropertyAccessor(new JspPropertyAccessor(pageContext));
  context.addPropertyAccessor(new MapAccessor());
  context.addPropertyAccessor(new EnvironmentAccessor());
  context.setBeanResolver(new BeanFactoryResolver(getRequestContext().getWebApplicationContext()));
  ConversionService conversionService = getConversionService(pageContext);
  if (conversionService != null) {
    context.setTypeConverter(new StandardTypeConverter(conversionService));
  }
  return context;
}

代码示例来源:origin: org.springframework.security/spring-security-config

@Override
  public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    this.beanResolver = new BeanFactoryResolver(applicationContext.getAutowireCapableBeanFactory());
  }
}

代码示例来源:origin: org.springframework.security/spring-security-config

@Bean
public AuthenticationPrincipalArgumentResolver authenticationPrincipalArgumentResolver() {
  AuthenticationPrincipalArgumentResolver resolver = new AuthenticationPrincipalArgumentResolver(
    this.adapterRegistry);
  if (this.beanFactory != null) {
    resolver.setBeanResolver(new BeanFactoryResolver(this.beanFactory));
  }
  return resolver;
}

代码示例来源:origin: spring-projects/spring-kafka

@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
  this.beanFactory = beanFactory;
  if (beanFactory instanceof ConfigurableListableBeanFactory) {
    this.resolver = ((ConfigurableListableBeanFactory) beanFactory).getBeanExpressionResolver();
    this.expressionContext = new BeanExpressionContext((ConfigurableListableBeanFactory) beanFactory, null);
  }
  this.beanResolver = new BeanFactoryResolver(beanFactory);
}

代码示例来源:origin: spring-projects/spring-integration

@Override
public void afterPropertiesSet() throws Exception {
  if (getApplicationContext() != null) {
    this.beanResolver = new BeanFactoryResolver(getApplicationContext());
  }
  initialize(IntegrationContextUtils.INTEGRATION_EVALUATION_CONTEXT_BEAN_NAME);
}

代码示例来源:origin: org.apache.camel/camel-spring

@Override
public void start() throws Exception {
  ObjectHelper.notNull(getCamelContext(), "CamelContext", this);
  if (getCamelContext() instanceof SpringCamelContext) {
    ApplicationContext applicationContext = ((SpringCamelContext) getCamelContext()).getApplicationContext();
    beanResolver = new BeanFactoryResolver(applicationContext);
  } else {
    beanResolver = new RegistryBeanResolver(getCamelContext().getRegistry());
  }
}

相关文章

微信公众号

最新文章

更多

BeanFactoryResolver类方法