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

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.

主站蜘蛛池模板: 确山县| 昂仁县| 泰顺县| 杨浦区| 天祝| 新化县| 云林县| 饶平县| 乌拉特中旗| 阳曲县| 永德县| 凉城县| 泸水县| 福鼎市| 萨嘎县| 绍兴县| 岐山县| 山东省| 固始县| 洪泽县| 鹰潭市| 常宁市| 黔西县| 信宜市| 会昌县| 武陟县| 化隆| 甘泉县| 富川| 固安县| 丹江口市| 左权县| 余干县| 响水县| 安图县| 长治市| 温宿县| 饶阳县| 南江县| 通许县| 龙泉市|