Each handler is also used for all the exception subtypes, when no more specific mapping 58 | * is found.
59 | * 60 | *Example: 61 | *
{@code 62 | *71 | */ 72 | private Map63 | * 69 | * 70 | * }
SpEL expressions are delimited by {@code #{} and {@code }}. The provided variables are 37 | * accessible directly by name.
38 | */ 39 | public class SpelMessageInterpolator implements MessageInterpolator { 40 | 41 | private static final Logger LOG = LoggerFactory.getLogger(SpelMessageInterpolator.class); 42 | 43 | private final EvaluationContext evalContext; 44 | 45 | 46 | /** 47 | * Creates a new instance with a custom {@link EvaluationContext}. 48 | */ 49 | public SpelMessageInterpolator(EvaluationContext evalContext) { 50 | Assert.notNull(evalContext, "EvaluationContext must not be null"); 51 | this.evalContext = evalContext; 52 | } 53 | 54 | /** 55 | * Creates a new instance with {@link StandardEvaluationContext} including 56 | * {@link org.springframework.expression.spel.support.ReflectivePropertyAccessor ReflectivePropertyAccessor} 57 | * and {@link MapAccessor}. 58 | */ 59 | public SpelMessageInterpolator() { 60 | StandardEvaluationContext ctx = new StandardEvaluationContext(); 61 | ctx.addPropertyAccessor(new MapAccessor()); 62 | this.evalContext = ctx; 63 | } 64 | 65 | 66 | public String interpolate(String messageTemplate, MapNote: It does not return all of the default converters defined in Spring, but just thus 82 | * usable for exception responses.
83 | */ 84 | @SuppressWarnings("deprecation") 85 | public static List