官术网_书友最值得收藏!

Configuring custom type formatters

Mostly because of its statefulness and lack of thread safety, since version 3, Spring has added a Formatter interface as a replacement for PropertyEditor. The formatters are intended to provide a similar functionality but in a completely thread-safe manner and focusing on a very specific task of parsing a String in an object type and converting an object to its String representation.

Let's suppose that for our application, we would like to have a formatter that would take the ISBN number of a book in a String form and convert it to a book entity object. This way, we can define the controller request methods with a Book argument when the request URL signature only contains an ISBN number or a database ID.

主站蜘蛛池模板: 峨山| 高平市| 剑川县| 百色市| 温宿县| 大石桥市| 秭归县| 新野县| 柘城县| 乐陵市| 梧州市| 开平市| 延津县| 怀远县| 兴宁市| 灵山县| 淮安市| 莲花县| 凉城县| 屯昌县| 舒城县| 襄垣县| 镇沅| 汉中市| 临沂市| 嘉义县| 永仁县| 颍上县| 乌兰县| 平顶山市| 盖州市| 贵阳市| 两当县| 平原县| 南陵县| 扶绥县| 司法| 甘孜| 来凤县| 谢通门县| 周口市|