Spring conversion

Comienza Ya. Es Gratis
ó regístrate con tu dirección de correo electrónico
Spring conversion por Mind Map: Spring conversion

1. Converter

1.1. registering converters

1.1.1. Spring boot auto registering converters-beans

1.1.2. You can create a bean of ConversionServiceFactoryBean, but it works only for main context, MVC doesn't see it

1.1.2.1. FormattingConversionServiceFactoryBean - will be picked up by MVC

1.1.3. FormatterRegistrar (Implements ConverterRegistry)

1.1.3.1. it's more about formatter, but there is an option to add converters in a group of Formatters/Converters and a register all together

1.1.4. addFormaters in WebMvcConfigurer

1.1.4.1. this produces also the ConversationService, which could be injected just in service classes and other beans

1.2. types of converters

1.2.1. Converter<S,T>

1.2.1.1. ConverterFactory

1.2.2. GenericConverter

1.2.3. ConditionalCoverter

2. PropertyEditor

2.1. Already existing editors

2.2. PropertyEditorRegistrar - the way to have editors registered in one place.

2.2.1. could be injected in MVC InitBinder

2.3. Could be registered in particular Controller by InitBinder

3. Formatter

3.1. types of Formatters

3.1.1. Formatter<>

3.1.2. AnnotationFormatterFactory

3.1.2.1. @NumberFormat

3.1.2.2. @DateTimeFormat

3.1.2.3. ...

3.2. registering formatters

3.2.1. Controller specific, via InitBinder

3.2.2. Spring boot auto registers the Formatter beans

3.2.3. FormattingConversionServiceFactoryBean

3.2.4. FormatterRegistrar

3.2.4.1. allows to group similar formatters and register them as the whole

3.2.5. addFormaters in WebMvcConfigurer

3.2.5.1. this produces also the ConversationService, which could be injected just in service classes and other beans