spring-framework / org.springframework.context / MessageSourceAware

MessageSourceAware

interface MessageSourceAware : Aware

Interface to be implemented by any object that wishes to be notified of the MessageSource (typically the ApplicationContext) that it runs in.

Note that the MessageSource can usually also be passed on as bean reference (to arbitrary bean properties or constructor arguments), because it is defined as bean with name "messageSource" in the application context.

Author
Juergen Hoeller

Author
Chris Beams

Since
1.1.1

See Also
ApplicationContextAware

Functions

setMessageSource

abstract fun setMessageSource(messageSource: MessageSource): Unit

Set the MessageSource that this object runs in.

Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. Invoked before ApplicationContextAware's setApplicationContext.

Inheritors

ResponseStatusExceptionResolver

open class ResponseStatusExceptionResolver : AbstractHandlerExceptionResolver, MessageSourceAware

A org.springframework.web.servlet.HandlerExceptionResolver that uses the ResponseStatus annotation to map exceptions to HTTP status codes.

This exception resolver is enabled by default in the org.springframework.web.servlet.DispatcherServlet and the MVC Java config and the MVC namespace.

As of 4.2 this resolver also looks recursively for @ResponseStatus present on cause exceptions, and as of 4.2.2 this resolver supports attribute overrides for @ResponseStatus in custom composed annotations.

As of 5.0 this resolver also supports ResponseStatusException.