PropertyEditors

PropertyEditor defines how to convert a string literal that is defined as a value for a property, or constructor argument in the bean definition files, to the target type. Spring can convert simple primitive values (such as int, long, and boolean) and their corresponding wrapper types (such as Integer, Long, and Boolean) from the string form to the target primitive type. Additionally, Spring uses a number of built-in PropertyEditor, allowing some extra types to be converted. The following table shows these built-in PropertyEditor and the target type to which each converts the string literal. All of these PropertyEditor are located in the org.springframework.beans.propertyeditor package:

Built-in PropertyEditor

Description

Get Spring Persistence with Hibernate now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.