use of org.springframework.context.expression.BeanFactoryAccessor in project core by craftercms.
the class SpELStringTemplateCompiler method init.
@PostConstruct
public void init() {
if (evalContext == null) {
evalContext = new StandardEvaluationContext();
}
if (evalContext instanceof StandardEvaluationContext) {
StandardEvaluationContext standardEvalContext = (StandardEvaluationContext) evalContext;
// PropertyAccessor used when the model is a BeanFactory.
standardEvalContext.addPropertyAccessor(new BeanFactoryAccessor());
if (beanFactory != null) {
if (standardEvalContext.getBeanResolver() == null) {
standardEvalContext.setBeanResolver(new BeanFactoryResolver(beanFactory));
}
if (standardEvalContext.getTypeLocator() == null) {
standardEvalContext.setTypeLocator(new StandardTypeLocator(beanFactory.getBeanClassLoader()));
}
if (standardEvalContext.getTypeConverter() == null) {
ConversionService conversionService = beanFactory.getConversionService();
if (conversionService != null) {
standardEvalContext.setTypeConverter(new StandardTypeConverter(conversionService));
}
}
}
}
}
use of org.springframework.context.expression.BeanFactoryAccessor in project spring-cloud-gcp by spring-cloud.
the class DatastorePersistentEntityImpl method setApplicationContext.
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.context.addPropertyAccessor(new BeanFactoryAccessor());
this.context.setBeanResolver(new BeanFactoryResolver(applicationContext));
this.context.setRootObject(applicationContext);
}
use of org.springframework.context.expression.BeanFactoryAccessor in project spring-cloud-gcp by spring-cloud.
the class DatastoreRepositoryFactory method delegateContextProvider.
private QueryMethodEvaluationContextProvider delegateContextProvider(QueryMethodEvaluationContextProvider evaluationContextProvider) {
return new QueryMethodEvaluationContextProvider() {
@Override
public <T extends Parameters<?, ?>> EvaluationContext getEvaluationContext(T parameters, Object[] parameterValues) {
StandardEvaluationContext evaluationContext = (StandardEvaluationContext) evaluationContextProvider.getEvaluationContext(parameters, parameterValues);
evaluationContext.setRootObject(DatastoreRepositoryFactory.this.applicationContext);
evaluationContext.addPropertyAccessor(new BeanFactoryAccessor());
evaluationContext.setBeanResolver(new BeanFactoryResolver(DatastoreRepositoryFactory.this.applicationContext));
return evaluationContext;
}
};
}
use of org.springframework.context.expression.BeanFactoryAccessor in project spring-data-mongodb by spring-projects.
the class BasicMongoPersistentEntity method setApplicationContext.
/*
* (non-Javadoc)
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
*/
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
context.addPropertyAccessor(new BeanFactoryAccessor());
context.setBeanResolver(new BeanFactoryResolver(applicationContext));
context.setRootObject(applicationContext);
}
use of org.springframework.context.expression.BeanFactoryAccessor in project spring-cloud-gcp by spring-cloud.
the class SpannerRepositoryFactory method delegateContextProvider.
private QueryMethodEvaluationContextProvider delegateContextProvider(QueryMethodEvaluationContextProvider evaluationContextProvider) {
return new QueryMethodEvaluationContextProvider() {
@Override
public <T extends Parameters<?, ?>> EvaluationContext getEvaluationContext(T parameters, Object[] parameterValues) {
StandardEvaluationContext evaluationContext = (StandardEvaluationContext) evaluationContextProvider.getEvaluationContext(parameters, parameterValues);
evaluationContext.setRootObject(SpannerRepositoryFactory.this.applicationContext);
evaluationContext.addPropertyAccessor(new BeanFactoryAccessor());
evaluationContext.setBeanResolver(new BeanFactoryResolver(SpannerRepositoryFactory.this.applicationContext));
return evaluationContext;
}
};
}
Aggregations