Class SpringMessageResolver
Object
org.thymeleaf.messageresolver.AbstractMessageResolver
org.thymeleaf.spring5.messageresolver.SpringMessageResolver
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.MessageSourceAware
,IMessageResolver
public class SpringMessageResolver
extends AbstractMessageResolver
implements org.springframework.context.MessageSourceAware
Implementation of IMessageResolver
that
integrates the standard Spring way of resolving messages into Thymeleaf.
Template-based resolution is done by means of using the available Spring-configured
MessageSource
objects.
Origin-based resolution is done in exactly the same way as in StandardMessageResolver
.
- Since:
- 3.0.3
- Author:
- Daniel Fernández
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateAbsentMessageRepresentation
(ITemplateContext context, Class<?> origin, String key, Object[] messageParameters) final org.springframework.context.MessageSource
Returns the message source (MessageSource
) to be used for message resolution.final String
resolveMessage
(ITemplateContext context, Class<?> origin, String key, Object[] messageParameters) final void
setMessageSource
(org.springframework.context.MessageSource messageSource) Sets the message source to be used for message resolutionMethods inherited from class org.thymeleaf.messageresolver.AbstractMessageResolver
getName, getOrder, setName, setOrder
-
Constructor Details
-
SpringMessageResolver
public SpringMessageResolver()
-
-
Method Details
-
getMessageSource
public final org.springframework.context.MessageSource getMessageSource()Returns the message source (
MessageSource
) to be used for message resolution.- Returns:
- the message source
-
setMessageSource
public final void setMessageSource(org.springframework.context.MessageSource messageSource) Sets the message source to be used for message resolution
- Specified by:
setMessageSource
in interfaceorg.springframework.context.MessageSourceAware
- Parameters:
messageSource
- the message source
-
resolveMessage
public final String resolveMessage(ITemplateContext context, Class<?> origin, String key, Object[] messageParameters) - Specified by:
resolveMessage
in interfaceIMessageResolver
-
createAbsentMessageRepresentation
public String createAbsentMessageRepresentation(ITemplateContext context, Class<?> origin, String key, Object[] messageParameters) - Specified by:
createAbsentMessageRepresentation
in interfaceIMessageResolver
-