Class HttpMessageConverters

  • All Implemented Interfaces:
    Iterable<org.springframework.http.converter.HttpMessageConverter<?>>

    public class HttpMessageConverters
    extends Object
    implements Iterable<org.springframework.http.converter.HttpMessageConverter<?>>
    Bean used to manage the HttpMessageConverters used in a Spring Boot application. Provides a convenient way to add and merge additional HttpMessageConverters to a web application.

    An instance of this bean can be registered with specific additional converters if needed, otherwise default converters will be used.

    NOTE: The default converters used are the same as standard Spring MVC (see WebMvcConfigurationSupport.getMessageConverters() with some slight re-ordering to put XML converters at the back of the list.

    See Also:
    HttpMessageConverters(HttpMessageConverter...), HttpMessageConverters(Collection), getConverters()
    • Constructor Detail

      • HttpMessageConverters

        public HttpMessageConverters​(org.springframework.http.converter.HttpMessageConverter<?>... additionalConverters)
        Create a new HttpMessageConverters instance with the specified additional converters.
        Parameters:
        additionalConverters - additional converters to be added. Items are added just before any default converter of the same type (or at the front of the list if no default converter is found) The postProcessConverters(List) method can be used for further converter manipulation.
      • HttpMessageConverters

        public HttpMessageConverters​(Collection<org.springframework.http.converter.HttpMessageConverter<?>> additionalConverters)
        Create a new HttpMessageConverters instance with the specified additional converters.
        Parameters:
        additionalConverters - additional converters to be added. Items are added just before any default converter of the same type (or at the front of the list if no default converter is found) The postProcessConverters(List) method can be used for further converter manipulation.
      • HttpMessageConverters

        public HttpMessageConverters​(boolean addDefaultConverters,
                                     Collection<org.springframework.http.converter.HttpMessageConverter<?>> converters)
        Create a new HttpMessageConverters instance with the specified converters.
        Parameters:
        addDefaultConverters - if default converters should be added
        converters - converters to be added. Items are added just before any default converter of the same type (or at the front of the list if no default converter is found) The postProcessConverters(List) method can be used for further converter manipulation.
    • Method Detail

      • postProcessConverters

        protected List<org.springframework.http.converter.HttpMessageConverter<?>> postProcessConverters​(List<org.springframework.http.converter.HttpMessageConverter<?>> converters)
        Method that can be used to post-process the HttpMessageConverter list before it is used.
        Parameters:
        converters - a mutable list of the converters that will be used.
        Returns:
        the final converts list to use
      • postProcessPartConverters

        protected List<org.springframework.http.converter.HttpMessageConverter<?>> postProcessPartConverters​(List<org.springframework.http.converter.HttpMessageConverter<?>> converters)
        Method that can be used to post-process the HttpMessageConverter list before it is used to configure the part converters of AllEncompassingFormHttpMessageConverter.
        Parameters:
        converters - a mutable list of the converters that will be used.
        Returns:
        the final converts list to use
        Since:
        1.3.0
      • iterator

        public Iterator<org.springframework.http.converter.HttpMessageConverter<?>> iterator()
        Specified by:
        iterator in interface Iterable<org.springframework.http.converter.HttpMessageConverter<?>>
      • getConverters

        public List<org.springframework.http.converter.HttpMessageConverter<?>> getConverters()
        Return an immutable list of the converters in the order that they will be registered.
        Returns:
        the converters