实体对象在使用Spel访问属性时是:"#user.address.city" 去访问的
context.setVariable("user", new UserCopy("name",new Address("province", "city"););
parser.parseExpression("#user.address.city").getValue(context)
Json/Map以同样的方式访问会报错;
JSONObject jsonObject = JSONObject.parseObject(config);
String spel = "videoAnalyseConfig.VideoAnalyseRule.params.table[0]";
// String spel = "#root['videoAnalyseConfig']['VideoAnalyseRule']['params']['table'][0]";
ExpressionParser parser = new SpelExpressionParser();
StandardEvaluationContext context = new StandardEvaluationContext(jsonObject);
// 这里很关键,如果没有配置MapAccessor,那么只能用['c']['a']这种解析方式
context.addPropertyAccessor(new MapAccessor());
System.err.println(parser.parseExpression(spel).getValue(context));