use of org.springframework.expression.spel.support.ReflectivePropertyAccessor in project cas by apereo.
the class AbstractCasWebflowConfigurer method getSpringExpressionParser.
/**
* Gets spring expression parser.
*
* @return the spring expression parser
*/
public SpringELExpressionParser getSpringExpressionParser() {
val configuration = new SpelParserConfiguration();
val spelExpressionParser = new SpelExpressionParser(configuration);
val parser = new SpringELExpressionParser(spelExpressionParser, this.flowBuilderServices.getConversionService());
parser.addPropertyAccessor(new ActionPropertyAccessor());
parser.addPropertyAccessor(new BeanFactoryPropertyAccessor());
parser.addPropertyAccessor(new FlowVariablePropertyAccessor());
parser.addPropertyAccessor(new MapAdaptablePropertyAccessor());
parser.addPropertyAccessor(new MessageSourcePropertyAccessor());
parser.addPropertyAccessor(new ScopeSearchingPropertyAccessor());
parser.addPropertyAccessor(new BeanExpressionContextAccessor());
parser.addPropertyAccessor(new MapAccessor());
parser.addPropertyAccessor(new MapAdaptablePropertyAccessor());
parser.addPropertyAccessor(new EnvironmentAccessor());
parser.addPropertyAccessor(new ReflectivePropertyAccessor());
return parser;
}
use of org.springframework.expression.spel.support.ReflectivePropertyAccessor in project spring-framework by spring-projects.
the class SpelReproTests method propertyAccessOnNullTarget_SPR5663.
@Test
void propertyAccessOnNullTarget_SPR5663() throws AccessException {
PropertyAccessor accessor = new ReflectivePropertyAccessor();
EvaluationContext context = TestScenarioCreator.getTestEvaluationContext();
assertThat(accessor.canRead(context, null, "abc")).isFalse();
assertThat(accessor.canWrite(context, null, "abc")).isFalse();
assertThatIllegalStateException().isThrownBy(() -> accessor.read(context, null, "abc"));
assertThatIllegalStateException().isThrownBy(() -> accessor.write(context, null, "abc", "foo"));
}
use of org.springframework.expression.spel.support.ReflectivePropertyAccessor in project spring-framework by spring-projects.
the class SpelReproTests method SPR9994_bridgeMethods.
@Test
void SPR9994_bridgeMethods() throws Exception {
ReflectivePropertyAccessor accessor = new ReflectivePropertyAccessor();
StandardEvaluationContext context = new StandardEvaluationContext();
GenericImplementation target = new GenericImplementation();
accessor.write(context, target, "property", "1");
assertThat(target.value).isEqualTo(1);
TypedValue value = accessor.read(context, target, "property");
assertThat(value.getValue()).isEqualTo(1);
assertThat(value.getTypeDescriptor().getType()).isEqualTo(Integer.class);
assertThat(value.getTypeDescriptor().getAnnotations()).isNotEmpty();
}
Aggregations