spring-expression-language

How to add an object without a constructor to a list using Spring Expression Language

为君一笑 提交于 2020-08-08 13:54:04
问题 I want to add a BigDecimal to a list using Spring Expression Language. public class SpelTest { public List<BigDecimal> values; StandardEvaluationContext context; SpelExpressionParser parser; @Before public void setup() { values = new ArrayList<>(); context = new StandardEvaluationContext(this); parser = new SpelExpressionParser(new SpelParserConfiguration(true, true)); } @Test public void shouldChangeValue() { values.add(BigDecimal.ONE); parser.parseExpression("values[0]").setValue(context,

How to add an object without a constructor to a list using Spring Expression Language

☆樱花仙子☆ 提交于 2020-08-08 13:51:58
问题 I want to add a BigDecimal to a list using Spring Expression Language. public class SpelTest { public List<BigDecimal> values; StandardEvaluationContext context; SpelExpressionParser parser; @Before public void setup() { values = new ArrayList<>(); context = new StandardEvaluationContext(this); parser = new SpelExpressionParser(new SpelParserConfiguration(true, true)); } @Test public void shouldChangeValue() { values.add(BigDecimal.ONE); parser.parseExpression("values[0]").setValue(context,