Data conversion, formatting, validation
Data binding mechanism
Data type conversions
The lower version of spring supports only the standard PropertyEditor type system, but the PropertyEditor has the following drawbacks:
Conversions that can be used only for strings and Java objects, not for conversions between any of the two Java types;
The context information (such as annotations, the structure of the host class, etc.) is not sensitive to the source object and the target object, which cannot be used to implement advanced conversion logic when type conversion occurs.
In view of this, spring 3.0 adds a common type conversion module to the core model, and Conversionservice is the core interface of the spring type conversion architecture.
Spring 3.0 supports both PropertyEditor and Conversionservice for type conversion, working with a type conversion system in Bean configuration, Spring MVC processing method entry bindings.
For simple type conversions, it is still recommended to use PropertyEditor. According to the PropertyEditor protocol, the Bean class will automatically find out if the same class package exists <beanname>editor.class, if there is an editor that uses it as a bean.
<bean id= "Expiremanager"
class= "Com.book.core.cache.expire.SimpleCacheLogicExpireManager" >
<property name= "Cachespacelist" >
<list>
<value>combookspace:com/combook/**</value>
<value>bookspace:com/book/**:100</value>
<value>companyspace:com/company/**</value>
</list>
</property>
</bean>
Spring MVC (iii) Data conversion, formatting, validation