public class SpelMessageInterpolator extends Object implements MessageInterpolator
MessageInterpolator
that uses the Spring Expression Language (SpEL)
to evaluate expressions inside a template message.
SpEL expressions are delimited by #{} and {@code }
. The provided variables are accessible
directly by name.
Constructor and Description |
---|
SpelMessageInterpolator()
Creates a new instance with
StandardEvaluationContext including
ReflectivePropertyAccessor and MapAccessor . |
SpelMessageInterpolator(org.springframework.expression.EvaluationContext evalContext)
Creates a new instance with a custom
EvaluationContext . |
Modifier and Type | Method and Description |
---|---|
String |
interpolate(String template,
Map<String,Object> variables)
Interpolates the message template using the given variables.
|
public SpelMessageInterpolator(org.springframework.expression.EvaluationContext evalContext)
EvaluationContext
.evalContext
- evalContextpublic SpelMessageInterpolator()
StandardEvaluationContext
including
ReflectivePropertyAccessor
and MapAccessor
.public String interpolate(String template, Map<String,Object> variables)
MessageInterpolator
interpolate
in interface MessageInterpolator
template
- The message to interpolate.variables
- Map of variables that will be accessible for the template.Copyright © 2017. All rights reserved.