-
-
Save wdahlenburg/b23ea56cdefc1386323fbb2bdf40b7bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static Object getValue(SpelExpressionParser parser, BeanFactory beanFactory, String entryValue) { | |
Object value; | |
String rawValue = entryValue; | |
if (rawValue != null) { | |
rawValue = rawValue.trim(); | |
} | |
if (rawValue != null && rawValue.startsWith("#{") && entryValue.endsWith("}")) { | |
// assume it's spel | |
StandardEvaluationContext context = new StandardEvaluationContext(); | |
context.setBeanResolver(new BeanFactoryResolver(beanFactory)); | |
Expression expression = parser.parseExpression(entryValue, new TemplateParserContext()); | |
value = expression.getValue(context); | |
} | |
else { | |
value = entryValue; | |
} | |
return value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment