类 ApplicationConversionService
- java.lang.Object
- org.springframework.core.convert.support.GenericConversionService
- org.springframework.format.support.FormattingConversionService
- org.springframework.boot.convert.ApplicationConversionService
- 所有已实现的接口:
org.springframework.beans.factory.Aware
,org.springframework.context.EmbeddedValueResolverAware
,org.springframework.core.convert.ConversionService
,org.springframework.core.convert.converter.ConverterRegistry
,org.springframework.core.convert.support.ConfigurableConversionService
,org.springframework.format.FormatterRegistry
public class ApplicationConversionService extends org.springframework.format.support.FormattingConversionService
A specialization ofFormattingConversionService
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)
andaddApplicationFormatters(FormatterRegistry)
utility methods for ad-hoc use against registry instance.- 从以下版本开始:
- 2.0.0
构造器概要
构造器 构造器 说明 ApplicationConversionService()
ApplicationConversionService(org.springframework.util.StringValueResolver embeddedValueResolver)
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 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
addDelimitedStringConverters(org.springframework.core.convert.converter.ConverterRegistry registry)
Add converters to support delimited strings.static void
configure(org.springframework.format.FormatterRegistry registry)
Configure the givenFormatterRegistry
with formatters and converters appropriate for most Spring Boot applications.static org.springframework.core.convert.ConversionService
getSharedInstance()
Return a shared default applicationConversionService
instance, lazily building it once needed.从类继承的方法 org.springframework.format.support.FormattingConversionService
addFormatter, addFormatterForFieldAnnotation, addFormatterForFieldType, addFormatterForFieldType, setEmbeddedValueResolver
从类继承的方法 org.springframework.core.convert.support.GenericConversionService
addConverter, addConverter, addConverter, addConverterFactory, canBypassConvert, canConvert, canConvert, convert, convert, convert, convertNullSource, getConverter, getDefaultConverter, removeConvertible, toString
构造器详细资料
ApplicationConversionService
public ApplicationConversionService()
ApplicationConversionService
public ApplicationConversionService(org.springframework.util.StringValueResolver embeddedValueResolver)
方法详细资料
getSharedInstance
public static org.springframework.core.convert.ConversionService getSharedInstance()
Return a shared default applicationConversionService
instance, lazily building it once needed.Note: This method actually returns an
ApplicationConversionService
instance. However, theConversionService
signature has been preserved for binary compatibility.- 返回:
- the shared
ApplicationConversionService
instance (nevernull
)
configure
public static void configure(org.springframework.format.FormatterRegistry registry)
Configure the givenFormatterRegistry
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 aConfigurableConversionService
)- 抛出:
ClassCastException
- if the given FormatterRegistry could not be cast to a ConversionService
addApplicationConverters
public static void addApplicationConverters(org.springframework.core.convert.converter.ConverterRegistry registry)
Add converters useful for most Spring Boot applications.- 参数:
registry
- the registry of converters to add to (must also be castable to ConversionService, e.g. being aConfigurableConversionService
)- 抛出:
ClassCastException
- if the given ConverterRegistry could not be cast to a ConversionService
addDelimitedStringConverters
public static void addDelimitedStringConverters(org.springframework.core.convert.converter.ConverterRegistry registry)
Add converters to support delimited strings.- 参数:
registry
- the registry of converters to add to (must also be castable to ConversionService, e.g. being aConfigurableConversionService
)- 抛出:
ClassCastException
- if the given ConverterRegistry could not be cast to a ConversionService
addApplicationFormatters
public static void addApplicationFormatters(org.springframework.format.FormatterRegistry registry)
Add formatters useful for most Spring Boot applications.- 参数:
registry
- the service to register default formatters with