spel

mp类型解析

#in[‘wid’]+’‘+#basicInfo[‘bosId’]+’‘+#basicInfo[‘merchantId’]+’‘+#basicInfo[‘productId’]+’‘+#basicInfo[‘productInstanceId’]+’‘+#basicInfo[‘tcode’] +’‘+#extParams[‘source’]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

StandardEvaluationContext context = new StandardEvaluationContext();
String[] parameterNames = VARIABLE_NAME_DISCOVERER.getParameterNames(method);

context.setVariable("method", method);
context.setVariable("methodName", method.getName());
context.addPropertyAccessor(new MapAccessor());


for (int i = 0; i < args.length; i++) {
context.setVariable(parameterNames[i], args[i]);
}


ExpressionParser parser = new SpelExpressionParser();


String result = spelParser.parseExpression(key).getValue(context, String.class)