11 Most Commonly Used Extension Points In Spring

omgzui
Javarevisited
Published in
9 min readDec 14, 2022

--

Photo by Clément Hélardot on Unsplash

In the process of using spring, have we found that its expansion ability is very strong? Due to the existence of this advantage, spring has a strong tolerance, so many third-party applications can easily fall into the embrace of spring.

1. Type Converter

Spring currently supports 3 types of converters:

  • Converter<S,T>: Convert an object of type S to an object of type T
  • ConverterFactory<S, R>: Convert S-type objects to R-type and subclass objects
  • GenericConverter: It supports the conversion of multiple sources and target types, and also provides the context of source and target types. This context allows you to perform type conversion based on annotations or information on attributes.

These three types of converters are used in different scenarios, let’s take Converter<S,T> as an example. In the entity object receiving parameters in the interface, there is a field whose type is Date, but the actual parameter passed is a string type: 2021-01-03 10:20:15, how to deal with it?

--

--

omgzui
Javarevisited

A full stack engineer, with some medicinal knowledge, likes to read and share.