public class ApplicationConversionService
extends org.springframework.format.support.FormattingConversionService
FormattingConversionService
configured by default with
converters and formatters appropriate for most Spring Boot applications.
Designed for direct instantiation but also exposes the static
addApplicationConverters(org.springframework.core.convert.converter.ConverterRegistry)
and
addApplicationFormatters(FormatterRegistry)
utility methods for ad-hoc use
against registry instance.
Constructor and Description |
---|
ApplicationConversionService() |
ApplicationConversionService(org.springframework.util.StringValueResolver embeddedValueResolver) |
Modifier and Type | Method and Description |
---|---|
static void |
addApplicationConverters(org.springframework.core.convert.converter.ConverterRegistry registry)
Add converters useful for most Spring Boot applications.
|
static void |
addApplicationFormatters(org.springframework.format.FormatterRegistry registry)
Add formatters useful for most Spring Boot applications.
|
static void |
addBeans(org.springframework.format.FormatterRegistry registry,
org.springframework.beans.factory.ListableBeanFactory beanFactory)
Add
GenericConverter , Converter , Printer , Parser
and Formatter beans from the specified context. |
static void |
addDelimitedStringConverters(org.springframework.core.convert.converter.ConverterRegistry registry)
Add converters to support delimited strings.
|
static void |
configure(org.springframework.format.FormatterRegistry registry)
Configure the given
FormatterRegistry with formatters and converters
appropriate for most Spring Boot applications. |
static org.springframework.core.convert.ConversionService |
getSharedInstance()
Return a shared default application
ConversionService instance, lazily
building it once needed. |
addFormatter, addFormatterForFieldAnnotation, addFormatterForFieldType, addFormatterForFieldType, addParser, addPrinter, setEmbeddedValueResolver
addConverter, addConverter, addConverter, addConverterFactory, canBypassConvert, canConvert, canConvert, convert, convert, convert, convertNullSource, getConverter, getDefaultConverter, removeConvertible, toString
public ApplicationConversionService()
public ApplicationConversionService(org.springframework.util.StringValueResolver embeddedValueResolver)
public static org.springframework.core.convert.ConversionService getSharedInstance()
ConversionService
instance, lazily
building it once needed.
Note: This method actually returns an ApplicationConversionService
instance. However, the ConversionService
signature has been preserved for
binary compatibility.
ApplicationConversionService
instance (never
null
)public static void configure(org.springframework.format.FormatterRegistry registry)
FormatterRegistry
with formatters and converters
appropriate for most Spring Boot applications.registry
- the registry of converters to add to (must also be castable to
ConversionService, e.g. being a ConfigurableConversionService
)ClassCastException
- if the given FormatterRegistry could not be cast to a
ConversionServicepublic static void addApplicationConverters(org.springframework.core.convert.converter.ConverterRegistry registry)
registry
- the registry of converters to add to (must also be castable to
ConversionService, e.g. being a ConfigurableConversionService
)ClassCastException
- if the given ConverterRegistry could not be cast to a
ConversionServicepublic static void addDelimitedStringConverters(org.springframework.core.convert.converter.ConverterRegistry registry)
registry
- the registry of converters to add to (must also be castable to
ConversionService, e.g. being a ConfigurableConversionService
)ClassCastException
- if the given ConverterRegistry could not be cast to a
ConversionServicepublic static void addApplicationFormatters(org.springframework.format.FormatterRegistry registry)
registry
- the service to register default formatters withpublic static void addBeans(org.springframework.format.FormatterRegistry registry, org.springframework.beans.factory.ListableBeanFactory beanFactory)
GenericConverter
, Converter
, Printer
, Parser
and Formatter
beans from the specified context.registry
- the service to register beans withbeanFactory
- the bean factory to get the beans fromCopyright © 2021 Pivotal Software, Inc.. All rights reserved.